code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def fit_meanshift(self, data, bandwidth=None, bin_seeding=False, **kwargs): """ Fit MeanShift clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. bandwidth : float The bandwidth v...
Fit MeanShift clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. bandwidth : float The bandwidth value used during clustering. If none, determined automatically. Note: th...
Below is the the instruction that describes the task: ### Input: Fit MeanShift clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. bandwidth : float The bandwidth value used during clustering...
def make_general(basis, use_copy=True): """ Makes one large general contraction for each angular momentum If use_copy is True, the input basis set is not modified. The output of this function is not pretty. If you want to make it nicer, use sort_basis afterwards. """ zero = '0.00000000' ...
Makes one large general contraction for each angular momentum If use_copy is True, the input basis set is not modified. The output of this function is not pretty. If you want to make it nicer, use sort_basis afterwards.
Below is the the instruction that describes the task: ### Input: Makes one large general contraction for each angular momentum If use_copy is True, the input basis set is not modified. The output of this function is not pretty. If you want to make it nicer, use sort_basis afterwards. ### Response: de...
def vcs_rbridge_config_input_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") vcs_rbridge_config = ET.Element("vcs_rbridge_config") config = vcs_rbridge_config input = ET.SubElement(vcs_rbridge_config, "input") rbridge_id = ET.S...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def vcs_rbridge_config_input_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") vcs_rbridge_config = ET.Element("vcs_rbridge_config") config =...
def remove_dependency_layer(self): """ Removes the dependency layer (if exists) of the object (in memory) """ if self.dependency_layer is not None: this_node = self.dependency_layer.get_node() self.root.remove(this_node) self.dependency_layer = self.my...
Removes the dependency layer (if exists) of the object (in memory)
Below is the the instruction that describes the task: ### Input: Removes the dependency layer (if exists) of the object (in memory) ### Response: def remove_dependency_layer(self): """ Removes the dependency layer (if exists) of the object (in memory) """ if self.dependency_layer is...
def csrf_generator(secret): """ Generates CSRF token. Inspired by this article: http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html :returns: :class:`str` Random unguessable string. """ # Create hash from random string plus sal...
Generates CSRF token. Inspired by this article: http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html :returns: :class:`str` Random unguessable string.
Below is the the instruction that describes the task: ### Input: Generates CSRF token. Inspired by this article: http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html :returns: :class:`str` Random unguessable string. ### Response: def csrf_generator(secret):...
def find_match_scp(self, rule): # pylint: disable-msg=R0911,R0912 """Handle scp commands.""" orig_list = [] orig_list.extend(self.original_command_list) binary = orig_list.pop(0) allowed_binaries = ['scp', '/usr/bin/scp'] if binary not in allowed_binaries: s...
Handle scp commands.
Below is the the instruction that describes the task: ### Input: Handle scp commands. ### Response: def find_match_scp(self, rule): # pylint: disable-msg=R0911,R0912 """Handle scp commands.""" orig_list = [] orig_list.extend(self.original_command_list) binary = orig_list.pop(0) ...
def xor(s, pad): '''XOR a given string ``s`` with the one-time-pad ``pad``''' from itertools import cycle s = bytearray(force_bytes(s, encoding='latin-1')) pad = bytearray(force_bytes(pad, encoding='latin-1')) return binary_type(bytearray(x ^ y for x, y in zip(s, cycle(pad))))
XOR a given string ``s`` with the one-time-pad ``pad``
Below is the the instruction that describes the task: ### Input: XOR a given string ``s`` with the one-time-pad ``pad`` ### Response: def xor(s, pad): '''XOR a given string ``s`` with the one-time-pad ``pad``''' from itertools import cycle s = bytearray(force_bytes(s, encoding='latin-1')) pad = byt...
def factor_coeff(cls, ops, kwargs): """Factor out coefficients of all factors.""" coeffs, nops = zip(*map(_coeff_term, ops)) coeff = 1 for c in coeffs: coeff *= c if coeff == 1: return nops, coeffs else: return coeff * cls.create(*nops, **kwargs)
Factor out coefficients of all factors.
Below is the the instruction that describes the task: ### Input: Factor out coefficients of all factors. ### Response: def factor_coeff(cls, ops, kwargs): """Factor out coefficients of all factors.""" coeffs, nops = zip(*map(_coeff_term, ops)) coeff = 1 for c in coeffs: coeff *= c if co...
def _calculate_feature_stats(feature_list, prepared, serialization_file): # pylint: disable=R0914 """Calculate min, max and mean for each feature. Store it in object.""" # Create feature only list feats = [x for x, _ in prepared] # Label is not necessary # Calculate all means / mins / maxs means ...
Calculate min, max and mean for each feature. Store it in object.
Below is the the instruction that describes the task: ### Input: Calculate min, max and mean for each feature. Store it in object. ### Response: def _calculate_feature_stats(feature_list, prepared, serialization_file): # pylint: disable=R0914 """Calculate min, max and mean for each feature. Store it in object...
def add_channel_info(self, data, clear=False): """ Add channel info data to the channel_id group. :param data: A dictionary of key/value pairs. Keys must be strings. Values can be strings or numeric values. :param clear: If set, any existing channel info data will be removed...
Add channel info data to the channel_id group. :param data: A dictionary of key/value pairs. Keys must be strings. Values can be strings or numeric values. :param clear: If set, any existing channel info data will be removed.
Below is the the instruction that describes the task: ### Input: Add channel info data to the channel_id group. :param data: A dictionary of key/value pairs. Keys must be strings. Values can be strings or numeric values. :param clear: If set, any existing channel info data will ...
def sample(self, input, steps): """ Sample outputs from LM. """ inputs = [[onehot(self.input_dim, x) for x in input]] for _ in range(steps): target = self.compute(inputs)[0,-1].argmax() input.append(target) inputs[0].append(onehot(self.input_di...
Sample outputs from LM.
Below is the the instruction that describes the task: ### Input: Sample outputs from LM. ### Response: def sample(self, input, steps): """ Sample outputs from LM. """ inputs = [[onehot(self.input_dim, x) for x in input]] for _ in range(steps): target = self.compu...
def _agl_compliant_name(glyph_name): """Return an AGL-compliant name string or None if we can't make one.""" MAX_GLYPH_NAME_LENGTH = 63 clean_name = re.sub("[^0-9a-zA-Z_.]", "", glyph_name) if len(clean_name) > MAX_GLYPH_NAME_LENGTH: return None return clean_name
Return an AGL-compliant name string or None if we can't make one.
Below is the the instruction that describes the task: ### Input: Return an AGL-compliant name string or None if we can't make one. ### Response: def _agl_compliant_name(glyph_name): """Return an AGL-compliant name string or None if we can't make one.""" MAX_GLYPH_NAME_LENGTH = 63 clean_name = re.sub("[...
def watch(): """Renerate documentation when it changes.""" # Start with a clean build sphinx_build['-b', 'html', '-E', 'docs', 'docs/_build/html'] & FG handler = ShellCommandTrick( shell_command='sphinx-build -b html docs docs/_build/html', patterns=['*.rst', '*.py'], ignore_pa...
Renerate documentation when it changes.
Below is the the instruction that describes the task: ### Input: Renerate documentation when it changes. ### Response: def watch(): """Renerate documentation when it changes.""" # Start with a clean build sphinx_build['-b', 'html', '-E', 'docs', 'docs/_build/html'] & FG handler = ShellCommandTric...
def grains(tgt=None, tgt_type='glob', **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached grains of the targeted minions. tgt Target to match minion ids. .. vers...
.. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached grains of the targeted minions. tgt Target to match minion ids. .. versionchanged:: 2017.7.5,2018.3.0 The ``tgt`` argume...
Below is the the instruction that describes the task: ### Input: .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Return cached grains of the targeted minions. tgt Target to match minion ids. ...
def load(tiff_filename): """ Import a TIFF file into a numpy array. Arguments: tiff_filename: A string filename of a TIFF datafile Returns: A numpy array with data from the TIFF file """ # Expand filename to be absolute tiff_filename = os.path.expanduser(tiff_filename) ...
Import a TIFF file into a numpy array. Arguments: tiff_filename: A string filename of a TIFF datafile Returns: A numpy array with data from the TIFF file
Below is the the instruction that describes the task: ### Input: Import a TIFF file into a numpy array. Arguments: tiff_filename: A string filename of a TIFF datafile Returns: A numpy array with data from the TIFF file ### Response: def load(tiff_filename): """ Import a TIFF file...
def contains(self, expected): """ Checks if the reference contains the value. :param expected: (object), the value to check (is allowed to be ``None``). :return: (bool), ``true`` if the value is found, ``false`` otherwise. """ return self._encode_invoke(atomic_reference...
Checks if the reference contains the value. :param expected: (object), the value to check (is allowed to be ``None``). :return: (bool), ``true`` if the value is found, ``false`` otherwise.
Below is the the instruction that describes the task: ### Input: Checks if the reference contains the value. :param expected: (object), the value to check (is allowed to be ``None``). :return: (bool), ``true`` if the value is found, ``false`` otherwise. ### Response: def contains(self, expected): ...
def create_vg(self, name, devices): """ Returns a new instance of VolumeGroup with the given name and added physycal volumes (devices):: from lvm2py import * lvm = LVM() vg = lvm.create_vg("myvg", ["/dev/sdb1", "/dev/sdb2"]) *Args:* * ...
Returns a new instance of VolumeGroup with the given name and added physycal volumes (devices):: from lvm2py import * lvm = LVM() vg = lvm.create_vg("myvg", ["/dev/sdb1", "/dev/sdb2"]) *Args:* * name (str): A volume group name. * ...
Below is the the instruction that describes the task: ### Input: Returns a new instance of VolumeGroup with the given name and added physycal volumes (devices):: from lvm2py import * lvm = LVM() vg = lvm.create_vg("myvg", ["/dev/sdb1", "/dev/sdb2"]) *Args:* ...
def kick_chat_member( self, chat_id: Union[int, str], user_id: Union[int, str], until_date: int = 0 ) -> Union["pyrogram.Message", bool]: """Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will ...
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. You must be an administrator in the chat for this to work and must have ...
Below is the the instruction that describes the task: ### Input: Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. You must be...
def sparse_message_pass(node_states, adjacency_matrices, num_edge_types, hidden_size, use_bias=True, average_aggregation=False, name="sparse_ggnn"): """One message-passing st...
One message-passing step for a GNN with a sparse adjacency matrix. Implements equation 2 (the message passing step) in [Li et al. 2015](https://arxiv.org/abs/1511.05493). N = The number of nodes in each batch. H = The size of the hidden states. T = The number of edge types. Args: node_states: Initial...
Below is the the instruction that describes the task: ### Input: One message-passing step for a GNN with a sparse adjacency matrix. Implements equation 2 (the message passing step) in [Li et al. 2015](https://arxiv.org/abs/1511.05493). N = The number of nodes in each batch. H = The size of the hidden stat...
def DumpAsCSV (self, separator=",", file=sys.stdout): """dump as a comma separated value file""" for row in range(1, self.maxRow + 1): sep = "" for column in range(1, self.maxColumn + 1): file.write("%s\...
dump as a comma separated value file
Below is the the instruction that describes the task: ### Input: dump as a comma separated value file ### Response: def DumpAsCSV (self, separator=",", file=sys.stdout): """dump as a comma separated value file""" for row in range(1, self.maxRow + 1): sep =...
def convert_date(value, parameter): ''' Converts to datetime.date: '', '-', None convert to parameter default The first matching format in settings.DATE_INPUT_FORMATS converts to datetime ''' value = _check_default(value, parameter, ( '', '-', None )) if value is None or isinstance(v...
Converts to datetime.date: '', '-', None convert to parameter default The first matching format in settings.DATE_INPUT_FORMATS converts to datetime
Below is the the instruction that describes the task: ### Input: Converts to datetime.date: '', '-', None convert to parameter default The first matching format in settings.DATE_INPUT_FORMATS converts to datetime ### Response: def convert_date(value, parameter): ''' Converts to datetime.dat...
def parse_callback_args(self, raw_args): """This is the method that is called from Script.run(), this is the insertion point for parsing all the arguments though on init this will find all args it can, so this method pulls already found args from class variables""" args = [] arg_...
This is the method that is called from Script.run(), this is the insertion point for parsing all the arguments though on init this will find all args it can, so this method pulls already found args from class variables
Below is the the instruction that describes the task: ### Input: This is the method that is called from Script.run(), this is the insertion point for parsing all the arguments though on init this will find all args it can, so this method pulls already found args from class variables ### Response: d...
def load(self, fpath): """Load a microscopy file. :param fpath: path to microscopy file """ def is_microscopy_item(fpath): """Return True if the fpath is likely to be microscopy data. :param fpath: file path to image :returns: :class:`bool` ...
Load a microscopy file. :param fpath: path to microscopy file
Below is the the instruction that describes the task: ### Input: Load a microscopy file. :param fpath: path to microscopy file ### Response: def load(self, fpath): """Load a microscopy file. :param fpath: path to microscopy file """ def is_microscopy_item(f...
def column_preview(table_name, col_name): """ Return the first ten elements of a column as JSON in Pandas' "split" format. """ col = orca.get_table(table_name).get_column(col_name).head(10) return ( col.to_json(orient='split', date_format='iso'), 200, {'Content-Type': '...
Return the first ten elements of a column as JSON in Pandas' "split" format.
Below is the the instruction that describes the task: ### Input: Return the first ten elements of a column as JSON in Pandas' "split" format. ### Response: def column_preview(table_name, col_name): """ Return the first ten elements of a column as JSON in Pandas' "split" format. """ col = o...
def handleThumbDblClick( self, item ): """ Handles when a thumbnail item is double clicked on. :param item | <QListWidgetItem> """ if ( isinstance(item, RecordListWidgetItem) ): self.emitRecordDoubleClicked(item.record())
Handles when a thumbnail item is double clicked on. :param item | <QListWidgetItem>
Below is the the instruction that describes the task: ### Input: Handles when a thumbnail item is double clicked on. :param item | <QListWidgetItem> ### Response: def handleThumbDblClick( self, item ): """ Handles when a thumbnail item is double clicked on. ...
def plot_intrusion_curve(self, fig=None): r""" Plot the percolation curve as the invader volume or number fraction vs the applied capillary pressure. """ # Begin creating nicely formatted plot x, y = self.get_intrusion_data() if fig is None: fig = plt...
r""" Plot the percolation curve as the invader volume or number fraction vs the applied capillary pressure.
Below is the the instruction that describes the task: ### Input: r""" Plot the percolation curve as the invader volume or number fraction vs the applied capillary pressure. ### Response: def plot_intrusion_curve(self, fig=None): r""" Plot the percolation curve as the invader volume ...
def _execute(self, queue, tasks, log, locks, queue_lock, all_task_ids): """ Executes the given tasks. Returns a boolean indicating whether the tasks were executed successfully. """ # The tasks must use the same function. assert len(tasks) task_func = tasks[0].ser...
Executes the given tasks. Returns a boolean indicating whether the tasks were executed successfully.
Below is the the instruction that describes the task: ### Input: Executes the given tasks. Returns a boolean indicating whether the tasks were executed successfully. ### Response: def _execute(self, queue, tasks, log, locks, queue_lock, all_task_ids): """ Executes the given tasks. Returns a...
def HEADING(txt=None, c="#"): """ Prints a message to stdout with #### surrounding it. This is useful for nosetests to better distinguish them. :param c: uses the given char to wrap the header :param txt: a text message to be printed :type txt: string """ frame = inspect.getouterframes(...
Prints a message to stdout with #### surrounding it. This is useful for nosetests to better distinguish them. :param c: uses the given char to wrap the header :param txt: a text message to be printed :type txt: string
Below is the the instruction that describes the task: ### Input: Prints a message to stdout with #### surrounding it. This is useful for nosetests to better distinguish them. :param c: uses the given char to wrap the header :param txt: a text message to be printed :type txt: string ### Response: d...
def append_skipped_rules(pyyaml_data, file_text, file_type): """ Uses ruamel.yaml to parse comments then adds a skipped_rules list to the task (or meta yaml block) """ yaml = ruamel.yaml.YAML() ruamel_data = yaml.load(file_text) if file_type in ('tasks', 'handlers'): ruamel_tasks = ...
Uses ruamel.yaml to parse comments then adds a skipped_rules list to the task (or meta yaml block)
Below is the the instruction that describes the task: ### Input: Uses ruamel.yaml to parse comments then adds a skipped_rules list to the task (or meta yaml block) ### Response: def append_skipped_rules(pyyaml_data, file_text, file_type): """ Uses ruamel.yaml to parse comments then adds a skipp...
def work_get(self, wallet, account): """ Retrieves work for **account** in **wallet** .. enable_control required .. version 8.0 required :param wallet: Wallet to get account work for :type wallet: str :param account: Account to get work for :type accoun...
Retrieves work for **account** in **wallet** .. enable_control required .. version 8.0 required :param wallet: Wallet to get account work for :type wallet: str :param account: Account to get work for :type account: str :raises: :py:exc:`nano.rpc.RPCException` ...
Below is the the instruction that describes the task: ### Input: Retrieves work for **account** in **wallet** .. enable_control required .. version 8.0 required :param wallet: Wallet to get account work for :type wallet: str :param account: Account to get work for ...
def validate(self, meta, val): """Validate an account_id""" val = string_or_int_as_string_spec().normalise(meta, val) if not regexes['amazon_account_id'].match(val): raise BadOption("Account id must match a particular regex", got=val, should_match=regexes['amazon_account_id'].pattern...
Validate an account_id
Below is the the instruction that describes the task: ### Input: Validate an account_id ### Response: def validate(self, meta, val): """Validate an account_id""" val = string_or_int_as_string_spec().normalise(meta, val) if not regexes['amazon_account_id'].match(val): raise BadOp...
def may_be_null_is_nullable(): """If may_be_null returns nullable or if NULL can be passed in. This can still be wrong if the specific typelib is older than the linked libgirepository. https://bugzilla.gnome.org/show_bug.cgi?id=660879#c47 """ repo = GIRepository() repo.require("GLib", "2....
If may_be_null returns nullable or if NULL can be passed in. This can still be wrong if the specific typelib is older than the linked libgirepository. https://bugzilla.gnome.org/show_bug.cgi?id=660879#c47
Below is the the instruction that describes the task: ### Input: If may_be_null returns nullable or if NULL can be passed in. This can still be wrong if the specific typelib is older than the linked libgirepository. https://bugzilla.gnome.org/show_bug.cgi?id=660879#c47 ### Response: def may_be_null_i...
def safedata(self, data, cdata=True): r"""Convert xml special chars to entities. :param data: the data will be converted safe. :param cdata: whether to use cdata. Default:``True``. If not, use :func:`cgi.escape` to convert data. :type cdata: bool :rtype: str """ ...
r"""Convert xml special chars to entities. :param data: the data will be converted safe. :param cdata: whether to use cdata. Default:``True``. If not, use :func:`cgi.escape` to convert data. :type cdata: bool :rtype: str
Below is the the instruction that describes the task: ### Input: r"""Convert xml special chars to entities. :param data: the data will be converted safe. :param cdata: whether to use cdata. Default:``True``. If not, use :func:`cgi.escape` to convert data. :type cdata: bool :rtype: s...
def render3d(self,view=None): """ Renders the world in 3d-mode. If you want to render custom terrain, you may override this method. Be careful that you still call the original method or else actors may not be rendered. """ for actor in self.actors.values(): a...
Renders the world in 3d-mode. If you want to render custom terrain, you may override this method. Be careful that you still call the original method or else actors may not be rendered.
Below is the the instruction that describes the task: ### Input: Renders the world in 3d-mode. If you want to render custom terrain, you may override this method. Be careful that you still call the original method or else actors may not be rendered. ### Response: def render3d(self,view=None): ...
def authenticate(self, username: str, password: str) -> bool: """Do an Authentricate request and save the cookie returned to be used on the following requests. Return True if the request was successfull """ self.username = username self.password = password auth_p...
Do an Authentricate request and save the cookie returned to be used on the following requests. Return True if the request was successfull
Below is the the instruction that describes the task: ### Input: Do an Authentricate request and save the cookie returned to be used on the following requests. Return True if the request was successfull ### Response: def authenticate(self, username: str, password: str) -> bool: """Do an Aut...
def zero_cluster(name): ''' Reset performance statistics to zero across the cluster. .. code-block:: yaml zero_ats_cluster: trafficserver.zero_cluster ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if __opts__['test']:...
Reset performance statistics to zero across the cluster. .. code-block:: yaml zero_ats_cluster: trafficserver.zero_cluster
Below is the the instruction that describes the task: ### Input: Reset performance statistics to zero across the cluster. .. code-block:: yaml zero_ats_cluster: trafficserver.zero_cluster ### Response: def zero_cluster(name): ''' Reset performance statistics to zero across the clust...
def find_library_full_path(name): """ Similar to `from ctypes.util import find_library`, but try to return full path if possible. """ from ctypes.util import find_library if os.name == "posix" and sys.platform == "darwin": # on Mac, ctypes already returns full path return find_l...
Similar to `from ctypes.util import find_library`, but try to return full path if possible.
Below is the the instruction that describes the task: ### Input: Similar to `from ctypes.util import find_library`, but try to return full path if possible. ### Response: def find_library_full_path(name): """ Similar to `from ctypes.util import find_library`, but try to return full path if possible...
def rename(self, new): """ .. seealso:: :func:`os.rename` """ os.rename(self, new) return self._next_class(new)
.. seealso:: :func:`os.rename`
Below is the the instruction that describes the task: ### Input: .. seealso:: :func:`os.rename` ### Response: def rename(self, new): """ .. seealso:: :func:`os.rename` """ os.rename(self, new) return self._next_class(new)
def get_network_by_device(vm, device, pyvmomi_service, logger): """ Get a Network connected to a particular Device (vNIC) @see https://github.com/vmware/pyvmomi/blob/master/docs/vim/dvs/PortConnection.rst :param vm: :param device: <vim.vm.device.VirtualVmxnet3> instance of adapt...
Get a Network connected to a particular Device (vNIC) @see https://github.com/vmware/pyvmomi/blob/master/docs/vim/dvs/PortConnection.rst :param vm: :param device: <vim.vm.device.VirtualVmxnet3> instance of adapter :param pyvmomi_service: :param logger: :return: <vim Netw...
Below is the the instruction that describes the task: ### Input: Get a Network connected to a particular Device (vNIC) @see https://github.com/vmware/pyvmomi/blob/master/docs/vim/dvs/PortConnection.rst :param vm: :param device: <vim.vm.device.VirtualVmxnet3> instance of adapter :par...
def progress(self): """ Returns a string representation of the progress of the search such as "1234/5000", which refers to the number of results retrived / the total number of results found """ if self.response is None: return "Query has not been executed" ...
Returns a string representation of the progress of the search such as "1234/5000", which refers to the number of results retrived / the total number of results found
Below is the the instruction that describes the task: ### Input: Returns a string representation of the progress of the search such as "1234/5000", which refers to the number of results retrived / the total number of results found ### Response: def progress(self): """ Returns a stri...
def show_buff(self, pos): """ Return the display of the instruction :rtype: string """ buff = self.get_name() + " " buff += "%x:" % self.first_key for i in self.targets: buff += " %x" % i return buff
Return the display of the instruction :rtype: string
Below is the the instruction that describes the task: ### Input: Return the display of the instruction :rtype: string ### Response: def show_buff(self, pos): """ Return the display of the instruction :rtype: string """ buff = self.get_name() + " " buff += "...
def remove(self, user, status=None, symmetrical=False): """ Remove a relationship from one user to another, with the same caveats and behavior as adding a relationship. """ if not status: status = RelationshipStatus.objects.following() res = Relationship.obje...
Remove a relationship from one user to another, with the same caveats and behavior as adding a relationship.
Below is the the instruction that describes the task: ### Input: Remove a relationship from one user to another, with the same caveats and behavior as adding a relationship. ### Response: def remove(self, user, status=None, symmetrical=False): """ Remove a relationship from one user to anot...
def _pload(offset, size): """ Generic parameter loading. Emmits output code for setting IX at the right location. size = Number of bytes to load: 1 => 8 bit value 2 => 16 bit value / string 4 => 32 bit value / f16 value 5 => 40 bit value """ output = [] indirect ...
Generic parameter loading. Emmits output code for setting IX at the right location. size = Number of bytes to load: 1 => 8 bit value 2 => 16 bit value / string 4 => 32 bit value / f16 value 5 => 40 bit value
Below is the the instruction that describes the task: ### Input: Generic parameter loading. Emmits output code for setting IX at the right location. size = Number of bytes to load: 1 => 8 bit value 2 => 16 bit value / string 4 => 32 bit value / f16 value 5 => 40 bit value ###...
def find_branches(self): """Find information about the branches in the repository.""" for prefix, name, revision_id in self.find_branches_raw(): yield Revision( branch=name, repository=self, revision_id=revision_id, )
Find information about the branches in the repository.
Below is the the instruction that describes the task: ### Input: Find information about the branches in the repository. ### Response: def find_branches(self): """Find information about the branches in the repository.""" for prefix, name, revision_id in self.find_branches_raw(): yield Re...
async def controller(self): """Return a Connection to the controller at self.endpoint """ return await Connection.connect( self.endpoint, username=self.username, password=self.password, cacert=self.cacert, bakery_client=self.bakery_clie...
Return a Connection to the controller at self.endpoint
Below is the the instruction that describes the task: ### Input: Return a Connection to the controller at self.endpoint ### Response: async def controller(self): """Return a Connection to the controller at self.endpoint """ return await Connection.connect( self.endpoint, ...
def _scobit_transform_deriv_v(systematic_utilities, alt_IDs, rows_to_alts, shape_params, output_array=None, *args, **kwargs): """ Parameters ---------- sy...
Parameters ---------- systematic_utilities : 1D ndarray. All elements should be ints, floats, or longs. Should contain the systematic utilities of each observation per available alternative. Note that this vector is formed by the dot product of the design matrix with the vector o...
Below is the the instruction that describes the task: ### Input: Parameters ---------- systematic_utilities : 1D ndarray. All elements should be ints, floats, or longs. Should contain the systematic utilities of each observation per available alternative. Note that this vector is for...
def determine_triad(triad, shorthand=False, no_inversions=False, placeholder=None): """Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspen...
Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspended triads. Also knows about invertions. Examples: >>> determine_triad(['A', 'C', 'E']...
Below is the the instruction that describes the task: ### Input: Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspended triads. Also knows abo...
def napalm_cli(task: Task, commands: List[str]) -> Result: """ Run commands on remote devices using napalm Arguments: commands: commands to execute Returns: Result object with the following attributes set: * result (``dict``): result of the commands execution """ devi...
Run commands on remote devices using napalm Arguments: commands: commands to execute Returns: Result object with the following attributes set: * result (``dict``): result of the commands execution
Below is the the instruction that describes the task: ### Input: Run commands on remote devices using napalm Arguments: commands: commands to execute Returns: Result object with the following attributes set: * result (``dict``): result of the commands execution ### Response: def...
def path_glob(pattern, current_dir=None): """Use pathlib for ant-like patterns, like: "**/*.py" :param pattern: File/directory pattern to use (as string). :param current_dir: Current working directory (as Path, pathlib.Path, str) :return Resolved Path (as path.Path). """ if not current_di...
Use pathlib for ant-like patterns, like: "**/*.py" :param pattern: File/directory pattern to use (as string). :param current_dir: Current working directory (as Path, pathlib.Path, str) :return Resolved Path (as path.Path).
Below is the the instruction that describes the task: ### Input: Use pathlib for ant-like patterns, like: "**/*.py" :param pattern: File/directory pattern to use (as string). :param current_dir: Current working directory (as Path, pathlib.Path, str) :return Resolved Path (as path.Path). ### Respo...
def get_selected_elements_of_core_class(self, core_element_type): """Returns all selected elements having the specified `core_element_type` as state element class :return: Subset of the selection, only containing elements having `core_element_type` as state element class :rtype: set """...
Returns all selected elements having the specified `core_element_type` as state element class :return: Subset of the selection, only containing elements having `core_element_type` as state element class :rtype: set
Below is the the instruction that describes the task: ### Input: Returns all selected elements having the specified `core_element_type` as state element class :return: Subset of the selection, only containing elements having `core_element_type` as state element class :rtype: set ### Response: def ...
def removeTags(dom): """ Remove all tags from `dom` and obtain plaintext representation. Args: dom (str, obj, array): str, HTMLElement instance or array of elements. Returns: str: Plain string without tags. """ # python 2 / 3 shill try: string_type = basestring ...
Remove all tags from `dom` and obtain plaintext representation. Args: dom (str, obj, array): str, HTMLElement instance or array of elements. Returns: str: Plain string without tags.
Below is the the instruction that describes the task: ### Input: Remove all tags from `dom` and obtain plaintext representation. Args: dom (str, obj, array): str, HTMLElement instance or array of elements. Returns: str: Plain string without tags. ### Response: def removeTags(dom): """...
def add_attribute(self, attribute_type, attribute_value): """ Adds a attribute to a Group/Indicator or Victim Args: attribute_type: attribute_value: Returns: attribute json """ if not self.can_update(): self._tcex.handle_error(910, ...
Adds a attribute to a Group/Indicator or Victim Args: attribute_type: attribute_value: Returns: attribute json
Below is the the instruction that describes the task: ### Input: Adds a attribute to a Group/Indicator or Victim Args: attribute_type: attribute_value: Returns: attribute json ### Response: def add_attribute(self, attribute_type, attribute_value): """ Adds...
def add_section(self, section): """A block section of code to be used as substitutions :param section: A block section of code to be used as substitutions :type section: Section """ self._sections = self._ensure_append(section, self._sections)
A block section of code to be used as substitutions :param section: A block section of code to be used as substitutions :type section: Section
Below is the the instruction that describes the task: ### Input: A block section of code to be used as substitutions :param section: A block section of code to be used as substitutions :type section: Section ### Response: def add_section(self, section): """A block section of code to be use...
def get_all_items_of_offer(self, offer_id): """ Get all items of offer This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param offer_id: the offer id :return: list """ ...
Get all items of offer This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param offer_id: the offer id :return: list
Below is the the instruction that describes the task: ### Input: Get all items of offer This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param offer_id: the offer id :return: list ### Resp...
def get_statements_by_hash(hash_list, ev_limit=100, best_first=True, tries=2): """Get fully formed statements from a list of hashes. Parameters ---------- hash_list : list[int or str] A list of statement hashes. ev_limit : int or None Limit the amount of evidence returned per Statem...
Get fully formed statements from a list of hashes. Parameters ---------- hash_list : list[int or str] A list of statement hashes. ev_limit : int or None Limit the amount of evidence returned per Statement. Default is 100. best_first : bool If True, the preassembled statement...
Below is the the instruction that describes the task: ### Input: Get fully formed statements from a list of hashes. Parameters ---------- hash_list : list[int or str] A list of statement hashes. ev_limit : int or None Limit the amount of evidence returned per Statement. Default is 1...
def amax(data, axis=None, mapper=None, blen=None, storage=None, create='array', **kwargs): """Compute the maximum value.""" return reduce_axis(data, axis=axis, reducer=np.amax, block_reducer=np.maximum, mapper=mapper, blen=blen, storage=storage, create=crea...
Compute the maximum value.
Below is the the instruction that describes the task: ### Input: Compute the maximum value. ### Response: def amax(data, axis=None, mapper=None, blen=None, storage=None, create='array', **kwargs): """Compute the maximum value.""" return reduce_axis(data, axis=axis, reducer=np.amax, ...
def attribute_path(self, attribute, missing=None, visitor=None): """ Generates a list of values of the `attribute` of all ancestors of this node (as well as the node itself). If a value is ``None``, then the optional value of `missing` is used (by default ``None``). By defau...
Generates a list of values of the `attribute` of all ancestors of this node (as well as the node itself). If a value is ``None``, then the optional value of `missing` is used (by default ``None``). By default, the ``getattr(node, attribute, None) or missing`` mechanism i...
Below is the the instruction that describes the task: ### Input: Generates a list of values of the `attribute` of all ancestors of this node (as well as the node itself). If a value is ``None``, then the optional value of `missing` is used (by default ``None``). By default, the ...
def get_stops_in_polygon( feed: "Feed", polygon: Polygon, geo_stops=None ) -> DataFrame: """ Return the slice of ``feed.stops`` that contains all stops that lie within the given Shapely Polygon object that is specified in WGS84 coordinates. Parameters ---------- feed : Feed polygon ...
Return the slice of ``feed.stops`` that contains all stops that lie within the given Shapely Polygon object that is specified in WGS84 coordinates. Parameters ---------- feed : Feed polygon : Shapely Polygon Specified in WGS84 coordinates geo_stops : Geopandas GeoDataFrame A...
Below is the the instruction that describes the task: ### Input: Return the slice of ``feed.stops`` that contains all stops that lie within the given Shapely Polygon object that is specified in WGS84 coordinates. Parameters ---------- feed : Feed polygon : Shapely Polygon Specified ...
def compute(self, text, # text for which to find the most similar event lang = "eng"): # language in which the text is written """ compute the list of most similar events for the given text """ params = { "lang": lang, "text": text, "topClusters...
compute the list of most similar events for the given text
Below is the the instruction that describes the task: ### Input: compute the list of most similar events for the given text ### Response: def compute(self, text, # text for which to find the most similar event lang = "eng"): # language in which the text is written ...
def main(cli_arguments: List[str]): """ Entrypoint. :param cli_arguments: arguments passed in via the CLI :raises SystemExit: always raised """ cli_configuration: CliConfiguration try: cli_configuration = parse_cli_configuration(cli_arguments) except InvalidCliArgumentError as e:...
Entrypoint. :param cli_arguments: arguments passed in via the CLI :raises SystemExit: always raised
Below is the the instruction that describes the task: ### Input: Entrypoint. :param cli_arguments: arguments passed in via the CLI :raises SystemExit: always raised ### Response: def main(cli_arguments: List[str]): """ Entrypoint. :param cli_arguments: arguments passed in via the CLI :raise...
def status(self): """ The current status of the event (started, finished or pending). """ myNow = timezone.localtime(timezone=self.tz) if getAwareDatetime(self.date, self.time_to, self.tz) < myNow: return "finished" elif getAwareDatetime(self.date, self.time_f...
The current status of the event (started, finished or pending).
Below is the the instruction that describes the task: ### Input: The current status of the event (started, finished or pending). ### Response: def status(self): """ The current status of the event (started, finished or pending). """ myNow = timezone.localtime(timezone=self.tz) ...
def resolve_nested_schema(self, schema): """Return the Open API representation of a marshmallow Schema. Adds the schema to the spec if it isn't already present. Typically will return a dictionary with the reference to the schema's path in the spec unless the `schema_name_resolver` retu...
Return the Open API representation of a marshmallow Schema. Adds the schema to the spec if it isn't already present. Typically will return a dictionary with the reference to the schema's path in the spec unless the `schema_name_resolver` returns `None`, in which case the returned dicto...
Below is the the instruction that describes the task: ### Input: Return the Open API representation of a marshmallow Schema. Adds the schema to the spec if it isn't already present. Typically will return a dictionary with the reference to the schema's path in the spec unless the `schema_na...
def _conv(self, name, x, filter_size, in_filters, out_filters, strides): """Convolution.""" if self.init_layers: conv = Conv2DnGPU(out_filters, (filter_size, filter_size), strides[1:3], 'SAME', w_name='DW') conv.name = name self.layers += [conv] ...
Convolution.
Below is the the instruction that describes the task: ### Input: Convolution. ### Response: def _conv(self, name, x, filter_size, in_filters, out_filters, strides): """Convolution.""" if self.init_layers: conv = Conv2DnGPU(out_filters, (filter_size, filter_size), ...
def get(map_name): """Get an instance of a map by name. Errors if the map doesn't exist.""" if isinstance(map_name, Map): return map_name # Get the list of maps. This isn't at module scope to avoid problems of maps # being defined after this module is imported. maps = get_maps() map_class = maps.get(ma...
Get an instance of a map by name. Errors if the map doesn't exist.
Below is the the instruction that describes the task: ### Input: Get an instance of a map by name. Errors if the map doesn't exist. ### Response: def get(map_name): """Get an instance of a map by name. Errors if the map doesn't exist.""" if isinstance(map_name, Map): return map_name # Get the list of ma...
def save(self): """ Saves an object to the database. .. code-block:: python #create a person instance person = Person(first_name='Kimberly', last_name='Eggleston') #saves it to Cassandra person.save() """ # handle polymorphic mod...
Saves an object to the database. .. code-block:: python #create a person instance person = Person(first_name='Kimberly', last_name='Eggleston') #saves it to Cassandra person.save()
Below is the the instruction that describes the task: ### Input: Saves an object to the database. .. code-block:: python #create a person instance person = Person(first_name='Kimberly', last_name='Eggleston') #saves it to Cassandra person.save() ### Response...
def coerce_to_pendulum(x: PotentialDatetimeType, assume_local: bool = False) -> Optional[DateTime]: """ Converts something to a :class:`pendulum.DateTime`. Args: x: something that may be coercible to a datetime assume_local: if ``True``, assume local timezone; if ``Fa...
Converts something to a :class:`pendulum.DateTime`. Args: x: something that may be coercible to a datetime assume_local: if ``True``, assume local timezone; if ``False``, assume UTC Returns: a :class:`pendulum.DateTime`, or ``None``. Raises: pendulum.parsing.ex...
Below is the the instruction that describes the task: ### Input: Converts something to a :class:`pendulum.DateTime`. Args: x: something that may be coercible to a datetime assume_local: if ``True``, assume local timezone; if ``False``, assume UTC Returns: a :class:`pend...
def all_simple_bb_paths(self, start_address, end_address): """Return a list of path between start and end address. """ bb_start = self._find_basic_block(start_address) bb_end = self._find_basic_block(end_address) paths = networkx.all_simple_paths(self._graph, source=bb_start.add...
Return a list of path between start and end address.
Below is the the instruction that describes the task: ### Input: Return a list of path between start and end address. ### Response: def all_simple_bb_paths(self, start_address, end_address): """Return a list of path between start and end address. """ bb_start = self._find_basic_block(start_...
def do_get(self, from_path, to_path): """ Copy file from Ndrive to local file and print out out the metadata. Examples: Ndrive> get file.txt ~/ndrive-file.txt """ to_file = open(os.path.expanduser(to_path), "wb") self.n.downloadFile(self.current_path + "/" + f...
Copy file from Ndrive to local file and print out out the metadata. Examples: Ndrive> get file.txt ~/ndrive-file.txt
Below is the the instruction that describes the task: ### Input: Copy file from Ndrive to local file and print out out the metadata. Examples: Ndrive> get file.txt ~/ndrive-file.txt ### Response: def do_get(self, from_path, to_path): """ Copy file from Ndrive to local file and pr...
async def paginate(self): """Actually paginate the entries and run the interactive loop if necessary.""" await self.show_page(1, first=True) while self.paginating: react = await self.bot.wait_for_reaction(message=self.message, check=self.react_check, timeout=120.0) if re...
Actually paginate the entries and run the interactive loop if necessary.
Below is the the instruction that describes the task: ### Input: Actually paginate the entries and run the interactive loop if necessary. ### Response: async def paginate(self): """Actually paginate the entries and run the interactive loop if necessary.""" await self.show_page(1, first=True) ...
def assert_subclass_of(typ, allowed_types # type: Union[Type, Tuple[Type]] ): """ An inlined version of subclass_of(var_types)(value) without 'return True': it does not return anything in case of success, and raises a IsWrongType exception in case of failure. ...
An inlined version of subclass_of(var_types)(value) without 'return True': it does not return anything in case of success, and raises a IsWrongType exception in case of failure. Used in validate and validation/validator :param typ: the type to check :param allowed_types: the type(s) to enforce. If a t...
Below is the the instruction that describes the task: ### Input: An inlined version of subclass_of(var_types)(value) without 'return True': it does not return anything in case of success, and raises a IsWrongType exception in case of failure. Used in validate and validation/validator :param typ: the t...
def prune_rares(self, cutoff=2): """ returns a **new** `Vocab` object that is similar to this one but with rare words removed. Note that the indices in the new `Vocab` will be remapped (because rare words will have been removed). :param cutoff: words occuring less than this number of ti...
returns a **new** `Vocab` object that is similar to this one but with rare words removed. Note that the indices in the new `Vocab` will be remapped (because rare words will have been removed). :param cutoff: words occuring less than this number of times are removed from the vocabulary. :return...
Below is the the instruction that describes the task: ### Input: returns a **new** `Vocab` object that is similar to this one but with rare words removed. Note that the indices in the new `Vocab` will be remapped (because rare words will have been removed). :param cutoff: words occuring less than t...
def join(self, url): """Join URLs Construct a full (“absolute”) URL by combining a “base URL” (self) with another URL (url). Informally, this uses components of the base URL, in particular the addressing scheme, the network location and (part of) the path, to provide mi...
Join URLs Construct a full (“absolute”) URL by combining a “base URL” (self) with another URL (url). Informally, this uses components of the base URL, in particular the addressing scheme, the network location and (part of) the path, to provide missing components in the ...
Below is the the instruction that describes the task: ### Input: Join URLs Construct a full (“absolute”) URL by combining a “base URL” (self) with another URL (url). Informally, this uses components of the base URL, in particular the addressing scheme, the network location and ...
def total_branches(self): """How many total branches are there?""" exit_counts = self.parser.exit_counts() return sum([count for count in exit_counts.values() if count > 1])
How many total branches are there?
Below is the the instruction that describes the task: ### Input: How many total branches are there? ### Response: def total_branches(self): """How many total branches are there?""" exit_counts = self.parser.exit_counts() return sum([count for count in exit_counts.values() if count > 1])
def get_index_node(self, idx): '''get node with iterindex `idx`''' idx = self.node_index.index(idx) return self.nodes[idx]
get node with iterindex `idx`
Below is the the instruction that describes the task: ### Input: get node with iterindex `idx` ### Response: def get_index_node(self, idx): '''get node with iterindex `idx`''' idx = self.node_index.index(idx) return self.nodes[idx]
def azureContainers(self, *args, **kwargs): """ List containers in an Account Managed by Auth Retrieve a list of all containers in an account. This method gives output: ``v1/azure-container-list-response.json#`` This method is ``stable`` """ return self._makeA...
List containers in an Account Managed by Auth Retrieve a list of all containers in an account. This method gives output: ``v1/azure-container-list-response.json#`` This method is ``stable``
Below is the the instruction that describes the task: ### Input: List containers in an Account Managed by Auth Retrieve a list of all containers in an account. This method gives output: ``v1/azure-container-list-response.json#`` This method is ``stable`` ### Response: def azureContainers...
def create_event(self, state, server, agentConfig): """Create an event with a message describing the replication state of a mongo node""" def get_state_description(state): if state == 0: return 'Starting Up' elif state == 1: return 'Pr...
Create an event with a message describing the replication state of a mongo node
Below is the the instruction that describes the task: ### Input: Create an event with a message describing the replication state of a mongo node ### Response: def create_event(self, state, server, agentConfig): """Create an event with a message describing the replication state of a ...
def process_input(self): """Called when socket is read-ready""" try: pyngus.read_socket_input(self.connection, self.socket) except Exception as e: LOG.error("Exception on socket read: %s", str(e)) self.connection.close_input() self.connection.close...
Called when socket is read-ready
Below is the the instruction that describes the task: ### Input: Called when socket is read-ready ### Response: def process_input(self): """Called when socket is read-ready""" try: pyngus.read_socket_input(self.connection, self.socket) except Exception as e: LOG.erro...
def home_lib(home): """Return the lib dir under the 'home' installation scheme""" if hasattr(sys, 'pypy_version_info'): lib = 'site-packages' else: lib = os.path.join('lib', 'python') return os.path.join(home, lib)
Return the lib dir under the 'home' installation scheme
Below is the the instruction that describes the task: ### Input: Return the lib dir under the 'home' installation scheme ### Response: def home_lib(home): """Return the lib dir under the 'home' installation scheme""" if hasattr(sys, 'pypy_version_info'): lib = 'site-packages' else: lib ...
def is_regular(self): """Determine whether this `Index` contains linearly increasing samples This also works for linear decrease """ if self.size <= 1: return False return numpy.isclose(numpy.diff(self.value, n=2), 0).all()
Determine whether this `Index` contains linearly increasing samples This also works for linear decrease
Below is the the instruction that describes the task: ### Input: Determine whether this `Index` contains linearly increasing samples This also works for linear decrease ### Response: def is_regular(self): """Determine whether this `Index` contains linearly increasing samples This also wor...
def reduce(self, func, dim=None, keep_attrs=None, **kwargs): """Reduce the items in this group by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `func(x, axis=axis, **kwargs)` to ret...
Reduce the items in this group by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `func(x, axis=axis, **kwargs)` to return the result of collapsing an np.ndarray over an integer v...
Below is the the instruction that describes the task: ### Input: Reduce the items in this group by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `func(x, axis=axis, **kwargs)` to return...
def reset(self): """ Reseting wrapped function """ super(SinonSpy, self).unwrap() super(SinonSpy, self).wrap2spy()
Reseting wrapped function
Below is the the instruction that describes the task: ### Input: Reseting wrapped function ### Response: def reset(self): """ Reseting wrapped function """ super(SinonSpy, self).unwrap() super(SinonSpy, self).wrap2spy()
def issubset(self, other): """Report whether another set contains this RangeSet.""" self._binary_sanity_check(other) return set.issubset(self, other)
Report whether another set contains this RangeSet.
Below is the the instruction that describes the task: ### Input: Report whether another set contains this RangeSet. ### Response: def issubset(self, other): """Report whether another set contains this RangeSet.""" self._binary_sanity_check(other) return set.issubset(self, other)
def updateItem(self, itemParameters, clearEmptyFields=False, data=None, metadata=None, text=None, serviceUrl=None, multipart=False): """ updates an item's properties using...
updates an item's properties using the ItemParameter class. Inputs: itemParameters - property class to update clearEmptyFields - boolean, cleans up empty values data - updates the file property of the service like a .sd file metadata - this is an xml file that contai...
Below is the the instruction that describes the task: ### Input: updates an item's properties using the ItemParameter class. Inputs: itemParameters - property class to update clearEmptyFields - boolean, cleans up empty values data - updates the file property of the service ...
async def mount(self, device): """ Mount the device if not already mounted. :param device: device object, block device path or mount path :returns: whether the device is mounted. """ device = self._find_device(device) if not self.is_handleable(device) or not devi...
Mount the device if not already mounted. :param device: device object, block device path or mount path :returns: whether the device is mounted.
Below is the the instruction that describes the task: ### Input: Mount the device if not already mounted. :param device: device object, block device path or mount path :returns: whether the device is mounted. ### Response: async def mount(self, device): """ Mount the device if not ...
def generate_time(signal, sample_rate=1000): """ ----- Brief ----- Function intended to generate a time axis of the input signal. ----------- Description ----------- The time axis generated by the acquisition process originates a set of consecutive values that represents the adv...
----- Brief ----- Function intended to generate a time axis of the input signal. ----------- Description ----------- The time axis generated by the acquisition process originates a set of consecutive values that represents the advancement of time, but does not have specific units. ...
Below is the the instruction that describes the task: ### Input: ----- Brief ----- Function intended to generate a time axis of the input signal. ----------- Description ----------- The time axis generated by the acquisition process originates a set of consecutive values that represents...
def non_silent_ratio_permutation(context_counts, context_to_mut, seq_context, gene_seq, num_permutations=10000): """Performs null-permutations for non-silent ratio across all genes. ...
Performs null-permutations for non-silent ratio across all genes. Parameters ---------- context_counts : pd.Series number of mutations for each context context_to_mut : dict dictionary mapping nucleotide context to a list of observed somatic base changes. seq_context : Seque...
Below is the the instruction that describes the task: ### Input: Performs null-permutations for non-silent ratio across all genes. Parameters ---------- context_counts : pd.Series number of mutations for each context context_to_mut : dict dictionary mapping nucleotide context to a l...
def validate_IRkernel(venv_dir): """Validates that this env contains an IRkernel kernel and returns info to start it Returns: tuple (ARGV, language, resource_dir) """ r_exe_name = find_exe(venv_dir, "R") if r_exe_name is None: return [], None, None # check if this is really an...
Validates that this env contains an IRkernel kernel and returns info to start it Returns: tuple (ARGV, language, resource_dir)
Below is the the instruction that describes the task: ### Input: Validates that this env contains an IRkernel kernel and returns info to start it Returns: tuple (ARGV, language, resource_dir) ### Response: def validate_IRkernel(venv_dir): """Validates that this env contains an IRkernel kernel and...
def __search_dict(self, obj, item, parent, parents_ids=frozenset({}), print_as_attribute=False): """Search dictionaries""" if print_as_attribute: parent_text = "%s.%s" else: ...
Search dictionaries
Below is the the instruction that describes the task: ### Input: Search dictionaries ### Response: def __search_dict(self, obj, item, parent, parents_ids=frozenset({}), print_as_attribute=False): "...
def pop_job(self, returning=True): """ Pop a job from the pending jobs list. When returning == True, we prioritize the jobs whose functions are known to be returning (function.returning is True). As an optimization, we are sorting the pending jobs list according to job.function.returnin...
Pop a job from the pending jobs list. When returning == True, we prioritize the jobs whose functions are known to be returning (function.returning is True). As an optimization, we are sorting the pending jobs list according to job.function.returning. :param bool returning: Only pop a pending j...
Below is the the instruction that describes the task: ### Input: Pop a job from the pending jobs list. When returning == True, we prioritize the jobs whose functions are known to be returning (function.returning is True). As an optimization, we are sorting the pending jobs list according to job.fun...
def msg_callback(self, callback): """Set the message callback.""" if callable(callback): self._msg_callback = callback else: self._msg_callback = None
Set the message callback.
Below is the the instruction that describes the task: ### Input: Set the message callback. ### Response: def msg_callback(self, callback): """Set the message callback.""" if callable(callback): self._msg_callback = callback else: self._msg_callback = None
def from_jsondict(cls, dict_, decode_string=base64.b64decode, **additional_args): r"""Create an instance from a JSON style dict. Instantiate this class with parameters specified by the dict. This method takes the following arguments. .. tabularcolumns:: |l|L| ...
r"""Create an instance from a JSON style dict. Instantiate this class with parameters specified by the dict. This method takes the following arguments. .. tabularcolumns:: |l|L| =============== ===================================================== Argument Descrpition ...
Below is the the instruction that describes the task: ### Input: r"""Create an instance from a JSON style dict. Instantiate this class with parameters specified by the dict. This method takes the following arguments. .. tabularcolumns:: |l|L| =============== =====================...
def save_config( self, cmd="copy running-config startup-config", confirm=True, confirm_response="y", ): """Save Config for Extreme SLX.""" return super(ExtremeSlxSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
Save Config for Extreme SLX.
Below is the the instruction that describes the task: ### Input: Save Config for Extreme SLX. ### Response: def save_config( self, cmd="copy running-config startup-config", confirm=True, confirm_response="y", ): """Save Config for Extreme SLX.""" return super(Ext...
def get_aliases(self, lang='en'): """ Retrieve the aliases in a certain language :param lang: The Wikidata language the description should be retrieved for :return: Returns a list of aliases, an empty list if none exist for the specified language """ if self.fast_run: ...
Retrieve the aliases in a certain language :param lang: The Wikidata language the description should be retrieved for :return: Returns a list of aliases, an empty list if none exist for the specified language
Below is the the instruction that describes the task: ### Input: Retrieve the aliases in a certain language :param lang: The Wikidata language the description should be retrieved for :return: Returns a list of aliases, an empty list if none exist for the specified language ### Response: def get_ali...
def check_limit(self, limit): """ Checks if the given limit is valid. A limit must be > 0 to be considered valid. Raises ValueError when the *limit* is not > 0. """ if limit > 0: self.limit = limit else: raise ValueError("Rule limit must ...
Checks if the given limit is valid. A limit must be > 0 to be considered valid. Raises ValueError when the *limit* is not > 0.
Below is the the instruction that describes the task: ### Input: Checks if the given limit is valid. A limit must be > 0 to be considered valid. Raises ValueError when the *limit* is not > 0. ### Response: def check_limit(self, limit): """ Checks if the given limit is valid. ...
def migrate_font(font): "Convert PythonCard font description to gui2py style" if 'faceName' in font: font['face'] = font.pop('faceName') if 'family' in font and font['family'] == 'sansSerif': font['family'] = 'sans serif' return font
Convert PythonCard font description to gui2py style
Below is the the instruction that describes the task: ### Input: Convert PythonCard font description to gui2py style ### Response: def migrate_font(font): "Convert PythonCard font description to gui2py style" if 'faceName' in font: font['face'] = font.pop('faceName') if 'family' in font and fon...
def set_background(self, color, loc='all'): """ Sets background color Parameters ---------- color : string or 3 item list, optional, defaults to white Either a string, rgb list, or hex color string. For example: color='white' color='w...
Sets background color Parameters ---------- color : string or 3 item list, optional, defaults to white Either a string, rgb list, or hex color string. For example: color='white' color='w' color=[1, 1, 1] color='#FFFFFF...
Below is the the instruction that describes the task: ### Input: Sets background color Parameters ---------- color : string or 3 item list, optional, defaults to white Either a string, rgb list, or hex color string. For example: color='white' col...
def from_dict(data, ctx): """ Instantiate a new PositionFinancing from a dict (generally from loading a JSON response). The data used to instantiate the PositionFinancing is a shallow copy of the dict passed in, with any complex child types instantiated appropriately. """...
Instantiate a new PositionFinancing from a dict (generally from loading a JSON response). The data used to instantiate the PositionFinancing is a shallow copy of the dict passed in, with any complex child types instantiated appropriately.
Below is the the instruction that describes the task: ### Input: Instantiate a new PositionFinancing from a dict (generally from loading a JSON response). The data used to instantiate the PositionFinancing is a shallow copy of the dict passed in, with any complex child types instantiated app...
def _after(self, response): """Calculates the request duration, and adds a transaction ID to the header. """ # Ignore excluded routes. if getattr(request, '_tracy_exclude', False): return response duration = None if getattr(request, '_tracy_start_time...
Calculates the request duration, and adds a transaction ID to the header.
Below is the the instruction that describes the task: ### Input: Calculates the request duration, and adds a transaction ID to the header. ### Response: def _after(self, response): """Calculates the request duration, and adds a transaction ID to the header. """ # Ignore excl...
def xyz(self): """Return all particle coordinates in this compound. Returns ------- pos : np.ndarray, shape=(n, 3), dtype=float Array with the positions of all particles. """ if not self.children: pos = np.expand_dims(self._pos, axis=0) el...
Return all particle coordinates in this compound. Returns ------- pos : np.ndarray, shape=(n, 3), dtype=float Array with the positions of all particles.
Below is the the instruction that describes the task: ### Input: Return all particle coordinates in this compound. Returns ------- pos : np.ndarray, shape=(n, 3), dtype=float Array with the positions of all particles. ### Response: def xyz(self): """Return all particle ...
def units(cls, scale=1): ''' :scale: optional integer scaling factor :return: list of three Point subclass Returns three points whose coordinates are the head of a unit vector from the origin ( conventionally i, j and k). ''' return [cls(x=scale), cls(y=scale), ...
:scale: optional integer scaling factor :return: list of three Point subclass Returns three points whose coordinates are the head of a unit vector from the origin ( conventionally i, j and k).
Below is the the instruction that describes the task: ### Input: :scale: optional integer scaling factor :return: list of three Point subclass Returns three points whose coordinates are the head of a unit vector from the origin ( conventionally i, j and k). ### Response: def units(cls, sca...