code stringlengths 75 104k | docstring stringlengths 1 46.9k | text stringlengths 164 112k |
|---|---|---|
def edges(self, data=False, native=True):
"""
Returns a list of all edges in the :class:`.GraphCollection`\.
Parameters
----------
data : bool
(default: False) If True, returns a list of 3-tuples containing
source and target node labels, and attributes.
... | Returns a list of all edges in the :class:`.GraphCollection`\.
Parameters
----------
data : bool
(default: False) If True, returns a list of 3-tuples containing
source and target node labels, and attributes.
Returns
-------
edges : list | Below is the the instruction that describes the task:
### Input:
Returns a list of all edges in the :class:`.GraphCollection`\.
Parameters
----------
data : bool
(default: False) If True, returns a list of 3-tuples containing
source and target node labels, and attrib... |
def fire_event(self, event_name, wait=False, *args, **kwargs):
"""
Fire an event to plugins.
PluginManager schedule @asyncio.coroutinecalls for each plugin on method called "on_" + event_name
For example, on_connect will be called on event 'connect'
Method calls are schedule in t... | Fire an event to plugins.
PluginManager schedule @asyncio.coroutinecalls for each plugin on method called "on_" + event_name
For example, on_connect will be called on event 'connect'
Method calls are schedule in the asyn loop. wait parameter must be set to true to wait until all
mehtods ... | Below is the the instruction that describes the task:
### Input:
Fire an event to plugins.
PluginManager schedule @asyncio.coroutinecalls for each plugin on method called "on_" + event_name
For example, on_connect will be called on event 'connect'
Method calls are schedule in the asyn loop. ... |
def build_vep_string(vep_info, vep_columns):
"""
Build a vep string formatted string.
Take a list with vep annotations and build a new vep string
Args:
vep_info (list): A list with vep annotation dictionaries
vep_columns (list): A list with the vep column names found in the
... | Build a vep string formatted string.
Take a list with vep annotations and build a new vep string
Args:
vep_info (list): A list with vep annotation dictionaries
vep_columns (list): A list with the vep column names found in the
header of the vcf
Returns:
string: ... | Below is the the instruction that describes the task:
### Input:
Build a vep string formatted string.
Take a list with vep annotations and build a new vep string
Args:
vep_info (list): A list with vep annotation dictionaries
vep_columns (list): A list with the vep column names foun... |
def normalizeSequence(sequence, considerDimensions=None):
"""
normalize sequence by subtracting the mean and
:param sequence: a list of data samples
:param considerDimensions: a list of dimensions to consider
:return: normalized sequence
"""
seq = np.array(sequence).astype('float64')
nSampleDim = seq.sh... | normalize sequence by subtracting the mean and
:param sequence: a list of data samples
:param considerDimensions: a list of dimensions to consider
:return: normalized sequence | Below is the the instruction that describes the task:
### Input:
normalize sequence by subtracting the mean and
:param sequence: a list of data samples
:param considerDimensions: a list of dimensions to consider
:return: normalized sequence
### Response:
def normalizeSequence(sequence, considerDimensions=Non... |
def get_account_api_key(self, account_id, api_key, **kwargs): # noqa: E501
"""Get API key details. # noqa: E501
An endpoint for retrieving API key details. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/api-keys/{apiKey} -H 'Authorization: Bearer API_KEY'` # n... | Get API key details. # noqa: E501
An endpoint for retrieving API key details. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/api-keys/{apiKey} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
... | Below is the the instruction that describes the task:
### Input:
Get API key details. # noqa: E501
An endpoint for retrieving API key details. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/api-keys/{apiKey} -H 'Authorization: Bearer API_KEY'` # noqa: E501
... |
def adjustButtons( self ):
"""
Adjusts the placement of the buttons for this line edit.
"""
y = 1
for btn in self.buttons():
btn.setIconSize(self.iconSize())
btn.setFixedSize(QSize(self.height() - 2, self.height() - 2))
# adju... | Adjusts the placement of the buttons for this line edit. | Below is the the instruction that describes the task:
### Input:
Adjusts the placement of the buttons for this line edit.
### Response:
def adjustButtons( self ):
"""
Adjusts the placement of the buttons for this line edit.
"""
y = 1
for btn in self.buttons():
... |
def create_db(self, instance_name, instance_type,
admin_username, admin_password, security_groups=None, db_name=None,
storage_size_gb=DEFAULT_STORAGE_SIZE_GB,
timeout_s=DEFAULT_TIMEOUT_S):
"""
Creates a database instance.
This method blocks until the db insta... | Creates a database instance.
This method blocks until the db instance is active, or until
:attr:`timeout_s` has elapsed.
By default, hpcloud *assigns* an automatically-generated set of
credentials for an admin user. In addition to launching the db
instance, this method uses th... | Below is the the instruction that describes the task:
### Input:
Creates a database instance.
This method blocks until the db instance is active, or until
:attr:`timeout_s` has elapsed.
By default, hpcloud *assigns* an automatically-generated set of
credentials for an admin user. ... |
def _kendall_tau_subtract(self, len_old, diff_neg, tau_old):
"""Compute Kendall tau delta.
The new sequence has length len_old - 1.
Parameters
----------
len_old : int
The length of the old sequence, used to compute tau_old.
diff_neg : int
Differ... | Compute Kendall tau delta.
The new sequence has length len_old - 1.
Parameters
----------
len_old : int
The length of the old sequence, used to compute tau_old.
diff_neg : int
Difference between concordant and non-concordant pairs.
tau_old : floa... | Below is the the instruction that describes the task:
### Input:
Compute Kendall tau delta.
The new sequence has length len_old - 1.
Parameters
----------
len_old : int
The length of the old sequence, used to compute tau_old.
diff_neg : int
Differenc... |
def _setup_opera(self, capabilities):
"""Setup Opera webdriver
:param capabilities: capabilities object
:returns: a new local Opera driver
"""
opera_driver = self.config.get('Driver', 'opera_driver_path')
self.logger.debug("Opera driver path given in properties: %s", ope... | Setup Opera webdriver
:param capabilities: capabilities object
:returns: a new local Opera driver | Below is the the instruction that describes the task:
### Input:
Setup Opera webdriver
:param capabilities: capabilities object
:returns: a new local Opera driver
### Response:
def _setup_opera(self, capabilities):
"""Setup Opera webdriver
:param capabilities: capabilities object
... |
def fcoe_get_login_output_fcoe_login_list_fcoe_login_session_mac(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fcoe_get_login = ET.Element("fcoe_get_login")
config = fcoe_get_login
output = ET.SubElement(fcoe_get_login, "output")
fcoe_l... | Auto Generated Code | Below is the the instruction that describes the task:
### Input:
Auto Generated Code
### Response:
def fcoe_get_login_output_fcoe_login_list_fcoe_login_session_mac(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fcoe_get_login = ET.Element("fcoe_get_login")... |
def _compute_gradients(self, loss_fn, x, unused_optim_state):
"""Compute a new value of `x` to minimize `loss_fn`.
Args:
loss_fn: a callable that takes `x`, a batch of images, and returns
a batch of loss values. `x` will be optimized to minimize
`loss_fn(x)`.
x: A list o... | Compute a new value of `x` to minimize `loss_fn`.
Args:
loss_fn: a callable that takes `x`, a batch of images, and returns
a batch of loss values. `x` will be optimized to minimize
`loss_fn(x)`.
x: A list of Tensors, the values to be updated. This is analogous
to... | Below is the the instruction that describes the task:
### Input:
Compute a new value of `x` to minimize `loss_fn`.
Args:
loss_fn: a callable that takes `x`, a batch of images, and returns
a batch of loss values. `x` will be optimized to minimize
`loss_fn(x)`.
x: A list o... |
def class_box(self, cn: ClassDefinitionName) -> str:
""" Generate a box for the class. Populate its interior only if (a) it hasn't previously been generated and
(b) it appears in the gen_classes list
@param cn:
@param inherited:
@return:
"""
slot_defs: List[str]... | Generate a box for the class. Populate its interior only if (a) it hasn't previously been generated and
(b) it appears in the gen_classes list
@param cn:
@param inherited:
@return: | Below is the the instruction that describes the task:
### Input:
Generate a box for the class. Populate its interior only if (a) it hasn't previously been generated and
(b) it appears in the gen_classes list
@param cn:
@param inherited:
@return:
### Response:
def class_box(self, c... |
def get_topic(self):
""" Returns the topic to consider. """
if not hasattr(self, 'topic'):
self.topic = get_object_or_404(
Topic.objects.select_related('forum').all(), pk=self.kwargs['pk'],
)
return self.topic | Returns the topic to consider. | Below is the the instruction that describes the task:
### Input:
Returns the topic to consider.
### Response:
def get_topic(self):
""" Returns the topic to consider. """
if not hasattr(self, 'topic'):
self.topic = get_object_or_404(
Topic.objects.select_related('forum').... |
def put(self, thing_id='0', property_name=None):
"""
Handle a PUT request.
thing_id -- ID of the thing this request is for
property_name -- the name of the property from the URL path
"""
thing = self.get_thing(thing_id)
if thing is None:
self.set_stat... | Handle a PUT request.
thing_id -- ID of the thing this request is for
property_name -- the name of the property from the URL path | Below is the the instruction that describes the task:
### Input:
Handle a PUT request.
thing_id -- ID of the thing this request is for
property_name -- the name of the property from the URL path
### Response:
def put(self, thing_id='0', property_name=None):
"""
Handle a PUT request... |
def geturi(self):
"""Return the re-combined version of the original URI reference as a
string.
"""
scheme, authority, path, query, fragment = self
# RFC 3986 5.3. Component Recomposition
result = []
if scheme is not None:
result.extend([scheme, self.... | Return the re-combined version of the original URI reference as a
string. | Below is the the instruction that describes the task:
### Input:
Return the re-combined version of the original URI reference as a
string.
### Response:
def geturi(self):
"""Return the re-combined version of the original URI reference as a
string.
"""
scheme, authority, pat... |
def _get_pkg_ds_avail():
'''
Get the package information of the available packages, maintained by dselect.
Note, this will be not very useful, if dselect isn't installed.
:return:
'''
avail = "/var/lib/dpkg/available"
if not salt.utils.path.which('dselect') or not os.path.exists(avail):
... | Get the package information of the available packages, maintained by dselect.
Note, this will be not very useful, if dselect isn't installed.
:return: | Below is the the instruction that describes the task:
### Input:
Get the package information of the available packages, maintained by dselect.
Note, this will be not very useful, if dselect isn't installed.
:return:
### Response:
def _get_pkg_ds_avail():
'''
Get the package information of the avai... |
def refine(self, filelist, regex, filterdir='out', **kwargs):
''' Returns a list of files filterd by a regular expression
Parameters
----------
filelist : list
A list of files to filter on.
regex : str
The regular expression string to filter your list
... | Returns a list of files filterd by a regular expression
Parameters
----------
filelist : list
A list of files to filter on.
regex : str
The regular expression string to filter your list
filterdir: {'in', 'out'}
Indicates the filter to be inc... | Below is the the instruction that describes the task:
### Input:
Returns a list of files filterd by a regular expression
Parameters
----------
filelist : list
A list of files to filter on.
regex : str
The regular expression string to filter your list
... |
def worker(wrapped, dkwargs, hash_value=None, *args, **kwargs):
"""
This is an asynchronous sender callable that uses the Django ORM to store
webhooks. Redis is used to handle the message queue.
dkwargs argument requires the following key/values:
:event: A string representi... | This is an asynchronous sender callable that uses the Django ORM to store
webhooks. Redis is used to handle the message queue.
dkwargs argument requires the following key/values:
:event: A string representing an event.
kwargs argument requires the following key/values
... | Below is the the instruction that describes the task:
### Input:
This is an asynchronous sender callable that uses the Django ORM to store
webhooks. Redis is used to handle the message queue.
dkwargs argument requires the following key/values:
:event: A string representing an event... |
def error(self, msg):
"""Callback run when a recoverable parsing error occurs"""
self._error = True
self._progress.printMsg('XML parse error: %s' % msg, error=True) | Callback run when a recoverable parsing error occurs | Below is the the instruction that describes the task:
### Input:
Callback run when a recoverable parsing error occurs
### Response:
def error(self, msg):
"""Callback run when a recoverable parsing error occurs"""
self._error = True
self._progress.printMsg('XML parse error: %s' % msg, error... |
def git_try_describe(repo_path):
"""Try to describe the current commit of a Git repository.
Return a string containing a string with the commit ID and/or a base tag,
if successful. Otherwise, return None.
"""
try:
p = subprocess.Popen(['git', 'describe', '--always', '--dirty'],
... | Try to describe the current commit of a Git repository.
Return a string containing a string with the commit ID and/or a base tag,
if successful. Otherwise, return None. | Below is the the instruction that describes the task:
### Input:
Try to describe the current commit of a Git repository.
Return a string containing a string with the commit ID and/or a base tag,
if successful. Otherwise, return None.
### Response:
def git_try_describe(repo_path):
"""Try to describe th... |
def get_address_list(value):
""" address_list = (address *("," address)) / obs-addr-list
obs-addr-list = *([CFWS] ",") address *("," [address / CFWS])
We depart from the formal grammar here by continuing to parse until the end
of the input, assuming the input to be entirely composed of an
addre... | address_list = (address *("," address)) / obs-addr-list
obs-addr-list = *([CFWS] ",") address *("," [address / CFWS])
We depart from the formal grammar here by continuing to parse until the end
of the input, assuming the input to be entirely composed of an
address-list. This is always true in emai... | Below is the the instruction that describes the task:
### Input:
address_list = (address *("," address)) / obs-addr-list
obs-addr-list = *([CFWS] ",") address *("," [address / CFWS])
We depart from the formal grammar here by continuing to parse until the end
of the input, assuming the input to be e... |
def rectangle(self, x, y, width, height):
"""Adds a closed sub-path rectangle
of the given size to the current path
at position ``(x, y)`` in user-space coordinates.
This method is logically equivalent to::
context.move_to(x, y)
context.rel_line_to(width, 0)
... | Adds a closed sub-path rectangle
of the given size to the current path
at position ``(x, y)`` in user-space coordinates.
This method is logically equivalent to::
context.move_to(x, y)
context.rel_line_to(width, 0)
context.rel_line_to(0, height)
c... | Below is the the instruction that describes the task:
### Input:
Adds a closed sub-path rectangle
of the given size to the current path
at position ``(x, y)`` in user-space coordinates.
This method is logically equivalent to::
context.move_to(x, y)
context.rel_line_... |
def pre(f, *args, **kwargs):
"""Automatically log progress on function entry. Default logging value:
info.
*Logging with values contained in the parameters of the decorated function*
Message (args[0]) may be a string to be formatted with parameters passed to
the decorated function. Each '{varname}'... | Automatically log progress on function entry. Default logging value:
info.
*Logging with values contained in the parameters of the decorated function*
Message (args[0]) may be a string to be formatted with parameters passed to
the decorated function. Each '{varname}' will be replaced by the value of
... | Below is the the instruction that describes the task:
### Input:
Automatically log progress on function entry. Default logging value:
info.
*Logging with values contained in the parameters of the decorated function*
Message (args[0]) may be a string to be formatted with parameters passed to
the dec... |
def dependent_data(self):
"""
Read-only Property
:return: Data belonging to each dependent variable as a dict with
variable names as key, data as value.
:rtype: collections.OrderedDict
"""
return OrderedDict((var, self.data[var])
... | Read-only Property
:return: Data belonging to each dependent variable as a dict with
variable names as key, data as value.
:rtype: collections.OrderedDict | Below is the the instruction that describes the task:
### Input:
Read-only Property
:return: Data belonging to each dependent variable as a dict with
variable names as key, data as value.
:rtype: collections.OrderedDict
### Response:
def dependent_data(self):
"""
R... |
def detail_dict(self):
"""A more detailed dict that includes the descriptions, sub descriptions, table
and columns."""
d = self.dict
def aug_col(c):
d = c.dict
d['stats'] = [s.dict for s in c.stats]
return d
d['table'] = self.table.dict
... | A more detailed dict that includes the descriptions, sub descriptions, table
and columns. | Below is the the instruction that describes the task:
### Input:
A more detailed dict that includes the descriptions, sub descriptions, table
and columns.
### Response:
def detail_dict(self):
"""A more detailed dict that includes the descriptions, sub descriptions, table
and columns."""
... |
def deploy_func_between_two_axis_partitions(
cls, axis, func, num_splits, len_of_left, kwargs, *partitions
):
"""Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
... | Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
(see `split_result_of_axis_func_pandas`).
len_of_left: ... | Below is the the instruction that describes the task:
### Input:
Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
... |
def key_exists(self, key):
"""Check if key has previously been added to this store.
This function makes a linear search through the log file and is very
slow.
Returns True if the event has previously been added, False otherwise.
"""
assert isinstance(key, str)
... | Check if key has previously been added to this store.
This function makes a linear search through the log file and is very
slow.
Returns True if the event has previously been added, False otherwise. | Below is the the instruction that describes the task:
### Input:
Check if key has previously been added to this store.
This function makes a linear search through the log file and is very
slow.
Returns True if the event has previously been added, False otherwise.
### Response:
def key_exi... |
def get_controller_state(self):
"""Returns the current state of the 3d mouse, a dictionary of pos, orn, grasp, and reset."""
dpos = self.control[:3] * 0.005
roll, pitch, yaw = self.control[3:] * 0.005
self.grasp = self.control_gripper
# convert RPY to an absolute orientation
... | Returns the current state of the 3d mouse, a dictionary of pos, orn, grasp, and reset. | Below is the the instruction that describes the task:
### Input:
Returns the current state of the 3d mouse, a dictionary of pos, orn, grasp, and reset.
### Response:
def get_controller_state(self):
"""Returns the current state of the 3d mouse, a dictionary of pos, orn, grasp, and reset."""
dpos = s... |
def is_meta_url (attr, attrs):
"""Check if the meta attributes contain a URL."""
res = False
if attr == "content":
equiv = attrs.get_true('http-equiv', u'').lower()
scheme = attrs.get_true('scheme', u'').lower()
res = equiv in (u'refresh',) or scheme in (u'dcterms.uri',)
if attr ... | Check if the meta attributes contain a URL. | Below is the the instruction that describes the task:
### Input:
Check if the meta attributes contain a URL.
### Response:
def is_meta_url (attr, attrs):
"""Check if the meta attributes contain a URL."""
res = False
if attr == "content":
equiv = attrs.get_true('http-equiv', u'').lower()
... |
def recalculate(self, parent, updates):
"""Re-calculate the value of parent sensor.
Parent's value is calculated by calling the associate aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updat... | Re-calculate the value of parent sensor.
Parent's value is calculated by calling the associate aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updates : sequence of :class:`katcp.Sensor` objects
... | Below is the the instruction that describes the task:
### Input:
Re-calculate the value of parent sensor.
Parent's value is calculated by calling the associate aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be upda... |
def density(self, r, rho0, gamma):
"""
computes the density
:param x:
:param y:
:param rho0:
:param a:
:param s:
:return:
"""
rho = rho0 / r**gamma
return rho | computes the density
:param x:
:param y:
:param rho0:
:param a:
:param s:
:return: | Below is the the instruction that describes the task:
### Input:
computes the density
:param x:
:param y:
:param rho0:
:param a:
:param s:
:return:
### Response:
def density(self, r, rho0, gamma):
"""
computes the density
:param x:
:pa... |
def batch_write_spans(
self, name, spans, retry=method.DEFAULT, timeout=method.DEFAULT
):
"""
Sends new spans to Stackdriver Trace or updates existing traces. If the
name of a trace that you send matches that of an existing trace, new
spans are added to the existing trace. At... | Sends new spans to Stackdriver Trace or updates existing traces. If the
name of a trace that you send matches that of an existing trace, new
spans are added to the existing trace. Attempt to update existing spans
results undefined behavior. If the name does not match, a new trace is
crea... | Below is the the instruction that describes the task:
### Input:
Sends new spans to Stackdriver Trace or updates existing traces. If the
name of a trace that you send matches that of an existing trace, new
spans are added to the existing trace. Attempt to update existing spans
results undefi... |
def edit_vlan(
self,
environment_id,
name,
number,
description,
acl_file,
acl_file_v6,
id_vlan):
"""Edit a VLAN
:param id_vlan: ID for Vlan
:param environment_id: ID for Environment.
:param n... | Edit a VLAN
:param id_vlan: ID for Vlan
:param environment_id: ID for Environment.
:param name: The name of VLAN.
:param description: Some description to VLAN.
:param number: Number of Vlan
:param acl_file: Acl IPv4 File name to VLAN.
:param acl_file_v6: Acl IPv6... | Below is the the instruction that describes the task:
### Input:
Edit a VLAN
:param id_vlan: ID for Vlan
:param environment_id: ID for Environment.
:param name: The name of VLAN.
:param description: Some description to VLAN.
:param number: Number of Vlan
:param acl_f... |
def get(self, uri, disable_proxy=False, stream=False):
"""Return Requests response to GET request."""
response = requests.get(
uri,
headers=self.headers,
allow_redirects=True,
cookies={},
stream=stream,
proxies=self.proxy if not dis... | Return Requests response to GET request. | Below is the the instruction that describes the task:
### Input:
Return Requests response to GET request.
### Response:
def get(self, uri, disable_proxy=False, stream=False):
"""Return Requests response to GET request."""
response = requests.get(
uri,
headers=self.headers,
... |
def set_base_prompt(
self, pri_prompt_terminator=">", alt_prompt_terminator="]", delay_factor=1
):
"""
Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is general and applies in multiple contexts. For Comwar... | Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is general and applies in multiple contexts. For Comware
this will be the router prompt with < > or [ ] stripped off.
This will be set on logging in, but not when enteri... | Below is the the instruction that describes the task:
### Input:
Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is general and applies in multiple contexts. For Comware
this will be the router prompt with < > or [ ] strip... |
def decode(obj, content_type):
# type: (np.array or Iterable or int or float, str) -> np.array
"""Decode an object ton a one of the default content types to a numpy array.
Args:
obj (object): to be decoded.
content_type (str): content type to be used.
Returns:
np.array: decoded... | Decode an object ton a one of the default content types to a numpy array.
Args:
obj (object): to be decoded.
content_type (str): content type to be used.
Returns:
np.array: decoded object. | Below is the the instruction that describes the task:
### Input:
Decode an object ton a one of the default content types to a numpy array.
Args:
obj (object): to be decoded.
content_type (str): content type to be used.
Returns:
np.array: decoded object.
### Response:
def decode(ob... |
def is_mastercard(n):
"""Checks if credit card number fits the mastercard format."""
n, length = str(n), len(str(n))
if length >= 16 and length <= 19:
if ''.join(n[:2]) in strings_between(51, 56):
return True
return False | Checks if credit card number fits the mastercard format. | Below is the the instruction that describes the task:
### Input:
Checks if credit card number fits the mastercard format.
### Response:
def is_mastercard(n):
"""Checks if credit card number fits the mastercard format."""
n, length = str(n), len(str(n))
if length >= 16 and length <= 19:
if ''.j... |
def install(self, destination):
""" Install a third party odoo add-on
:param string destination: the folder where the add-on should end up at.
"""
logger.info(
"Installing %s@%s to %s",
self.repo, self.commit if self.commit else self.branch, destination
)... | Install a third party odoo add-on
:param string destination: the folder where the add-on should end up at. | Below is the the instruction that describes the task:
### Input:
Install a third party odoo add-on
:param string destination: the folder where the add-on should end up at.
### Response:
def install(self, destination):
""" Install a third party odoo add-on
:param string destination: the fo... |
def get_p_vals(self, X):
'''
Parameters
----------
X : np.array
Array of word counts, shape (N, 2) where N is the vocab size. X[:,0] is the
positive class, while X[:,1] is the negative class. None by default
Returns
-------
np.array of p-values
'''
z_scores = self.get_scores(X[:, 0], X[:, 1])... | Parameters
----------
X : np.array
Array of word counts, shape (N, 2) where N is the vocab size. X[:,0] is the
positive class, while X[:,1] is the negative class. None by default
Returns
-------
np.array of p-values | Below is the the instruction that describes the task:
### Input:
Parameters
----------
X : np.array
Array of word counts, shape (N, 2) where N is the vocab size. X[:,0] is the
positive class, while X[:,1] is the negative class. None by default
Returns
-------
np.array of p-values
### Response:
de... |
def routeAnswer(self, originalSender, originalTarget, value, messageID):
"""
Implement L{IMessageRouter.routeMessage} by synchronously locating an
account via L{axiom.userbase.LoginSystem.accountByAddress}, and
delivering a response to it by calling a method on it and returning a
... | Implement L{IMessageRouter.routeMessage} by synchronously locating an
account via L{axiom.userbase.LoginSystem.accountByAddress}, and
delivering a response to it by calling a method on it and returning a
deferred containing its answer. | Below is the the instruction that describes the task:
### Input:
Implement L{IMessageRouter.routeMessage} by synchronously locating an
account via L{axiom.userbase.LoginSystem.accountByAddress}, and
delivering a response to it by calling a method on it and returning a
deferred containing its... |
def B012(t,i):
"""
Constructs ternary implication coding (0=not there, 2=U, 1=V)
t is B column position
i = |M|-1 to 0
"""
if not i:
return "1"
nA = Awidth(i)
nB = Bwidth(i)
nBB = nB + nA
if t < nB:
return "0"+B012(t,i-1)
elif t < nBB:
return "1"+A012(... | Constructs ternary implication coding (0=not there, 2=U, 1=V)
t is B column position
i = |M|-1 to 0 | Below is the the instruction that describes the task:
### Input:
Constructs ternary implication coding (0=not there, 2=U, 1=V)
t is B column position
i = |M|-1 to 0
### Response:
def B012(t,i):
"""
Constructs ternary implication coding (0=not there, 2=U, 1=V)
t is B column position
i = |M|-... |
def parseUri(stream, uri=None):
"""Read an XML document from a URI, and return a :mod:`lxml.etree`
document."""
return etree.parse(stream, parser=_get_xmlparser(), base_url=uri) | Read an XML document from a URI, and return a :mod:`lxml.etree`
document. | Below is the the instruction that describes the task:
### Input:
Read an XML document from a URI, and return a :mod:`lxml.etree`
document.
### Response:
def parseUri(stream, uri=None):
"""Read an XML document from a URI, and return a :mod:`lxml.etree`
document."""
return etree.parse(stream, parser=... |
def _max(self, memory, addr, **kwargs):
"""
Gets the maximum solution of an address.
"""
return memory.state.solver.max(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | Gets the maximum solution of an address. | Below is the the instruction that describes the task:
### Input:
Gets the maximum solution of an address.
### Response:
def _max(self, memory, addr, **kwargs):
"""
Gets the maximum solution of an address.
"""
return memory.state.solver.max(addr, exact=kwargs.pop('exact', self._exact... |
def convert_kwargs_to_cmd_line_args(kwargs):
"""Helper function to build command line arguments out of dict."""
args = []
for k in sorted(kwargs.keys()):
v = kwargs[k]
args.append('-{}'.format(k))
if v is not None:
args.append('{}'.format(v))
return args | Helper function to build command line arguments out of dict. | Below is the the instruction that describes the task:
### Input:
Helper function to build command line arguments out of dict.
### Response:
def convert_kwargs_to_cmd_line_args(kwargs):
"""Helper function to build command line arguments out of dict."""
args = []
for k in sorted(kwargs.keys()):
v... |
def decode_row(line, fields=None):
"""
Decode a raw line from a profile into a list of column values.
Decoding involves splitting the line by the field delimiter
(`"@"` by default) and unescaping special characters. If *fields*
is given, cast the values into the datatype given by their
respecti... | Decode a raw line from a profile into a list of column values.
Decoding involves splitting the line by the field delimiter
(`"@"` by default) and unescaping special characters. If *fields*
is given, cast the values into the datatype given by their
respective Field object.
Args:
line: a raw... | Below is the the instruction that describes the task:
### Input:
Decode a raw line from a profile into a list of column values.
Decoding involves splitting the line by the field delimiter
(`"@"` by default) and unescaping special characters. If *fields*
is given, cast the values into the datatype given... |
def mergeability_validation(tree:BubbleTree) -> iter:
"""Yield message about mergables powernodes"""
def gen_warnings(one, two, inc_message:str) -> [str]:
"Yield the warning for given (power)nodes if necessary"
nodetype = ''
if tree.inclusions[one] and tree.inclusions[two]:
n... | Yield message about mergables powernodes | Below is the the instruction that describes the task:
### Input:
Yield message about mergables powernodes
### Response:
def mergeability_validation(tree:BubbleTree) -> iter:
"""Yield message about mergables powernodes"""
def gen_warnings(one, two, inc_message:str) -> [str]:
"Yield the warning for g... |
def reconstruct(self, D=None):
"""Reconstruct representation."""
if D is None:
Df = self.Xf
else:
Df = sl.rfftn(D, None, self.cri.axisN)
Sf = np.sum(self.Zf * Df, axis=self.cri.axisM)
return sl.irfftn(Sf, self.cri.Nv, self.cri.axisN) | Reconstruct representation. | Below is the the instruction that describes the task:
### Input:
Reconstruct representation.
### Response:
def reconstruct(self, D=None):
"""Reconstruct representation."""
if D is None:
Df = self.Xf
else:
Df = sl.rfftn(D, None, self.cri.axisN)
Sf = np.sum(s... |
def schema(self):
"""The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema`
"""
if not self.__schema:
# Inherit context from parent.
context = getattr(self.parent, 'context', {})
if isinstance(self.nested... | The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema` | Below is the the instruction that describes the task:
### Input:
The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema`
### Response:
def schema(self):
"""The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serialize... |
def writeString(self, s):
"""
Writes a string to the stream. It will be B{UTF-8} encoded.
"""
s = self.context.getBytesForString(s)
self.writeBytes(s) | Writes a string to the stream. It will be B{UTF-8} encoded. | Below is the the instruction that describes the task:
### Input:
Writes a string to the stream. It will be B{UTF-8} encoded.
### Response:
def writeString(self, s):
"""
Writes a string to the stream. It will be B{UTF-8} encoded.
"""
s = self.context.getBytesForString(s)
sel... |
def watch(self, signal_name):
""" :meth:`.WSignalSourceProto.watch` implementation
:rtype: watcher: WSignalSource.Watcher
"""
watcher = WSignalSource.Watcher(
self.__queues[signal_name], lambda x: self.__watchers_callbacks[signal_name].remove(x)
)
self.__watchers_callbacks[signal_name].add(watcher)
re... | :meth:`.WSignalSourceProto.watch` implementation
:rtype: watcher: WSignalSource.Watcher | Below is the the instruction that describes the task:
### Input:
:meth:`.WSignalSourceProto.watch` implementation
:rtype: watcher: WSignalSource.Watcher
### Response:
def watch(self, signal_name):
""" :meth:`.WSignalSourceProto.watch` implementation
:rtype: watcher: WSignalSource.Watcher
"""
watcher = ... |
def ignore_warning(warning):
"""
Ignore any emitted warnings from a function.
:param warning: The category of warning to ignore.
"""
def decorator(func):
"""
Return a decorated function whose emitted warnings are ignored.
"""
@wraps(func)
def wrapper(*args, *... | Ignore any emitted warnings from a function.
:param warning: The category of warning to ignore. | Below is the the instruction that describes the task:
### Input:
Ignore any emitted warnings from a function.
:param warning: The category of warning to ignore.
### Response:
def ignore_warning(warning):
"""
Ignore any emitted warnings from a function.
:param warning: The category of warning to i... |
def remove(parent, idx):
"""Remove a value from a dict."""
if isinstance(parent, dict):
del parent[idx]
elif isinstance(parent, list):
del parent[int(idx)]
else:
raise JSONPathError("Invalid path for operation") | Remove a value from a dict. | Below is the the instruction that describes the task:
### Input:
Remove a value from a dict.
### Response:
def remove(parent, idx):
"""Remove a value from a dict."""
if isinstance(parent, dict):
del parent[idx]
elif isinstance(parent, list):
del parent[int(idx)]
else:
raise JSONPathError("Inval... |
def delete_registry(self, registry):
'''**Description**
Delete an existing image registry
**Arguments**
- registry: Full hostname/port of registry. Eg. myrepo.example.com:5000
'''
# do some input string checking
if re.match(".*\\/.*", registry):
... | **Description**
Delete an existing image registry
**Arguments**
- registry: Full hostname/port of registry. Eg. myrepo.example.com:5000 | Below is the the instruction that describes the task:
### Input:
**Description**
Delete an existing image registry
**Arguments**
- registry: Full hostname/port of registry. Eg. myrepo.example.com:5000
### Response:
def delete_registry(self, registry):
'''**Description**
... |
def export_child_lane_set(parent_xml_element, child_lane_set, plane_element):
"""
Creates 'childLaneSet' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'childLaneSet' element,
:param child_lane_set: dictionary with exported 'childLaneSe... | Creates 'childLaneSet' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'childLaneSet' element,
:param child_lane_set: dictionary with exported 'childLaneSet' element attributes and child elements,
:param plane_element: XML object, representing '... | Below is the the instruction that describes the task:
### Input:
Creates 'childLaneSet' element for exported BPMN XML file.
:param parent_xml_element: an XML element, parent of exported 'childLaneSet' element,
:param child_lane_set: dictionary with exported 'childLaneSet' element attributes and chi... |
def parse_args(args):
"""Uses python argparse to collect positional args"""
Log.info("Input args: %r" % args)
parser = argparse.ArgumentParser()
parser.add_argument("--shard", type=int, required=True)
parser.add_argument("--topology-name", required=True)
parser.add_argument("--topology-id", re... | Uses python argparse to collect positional args | Below is the the instruction that describes the task:
### Input:
Uses python argparse to collect positional args
### Response:
def parse_args(args):
"""Uses python argparse to collect positional args"""
Log.info("Input args: %r" % args)
parser = argparse.ArgumentParser()
parser.add_argument("--sh... |
def compile_ui(self, namespace, unknown):
"""Compile qt designer files
:param namespace: namespace containing arguments from the launch parser
:type namespace: Namespace
:param unknown: list of unknown arguments
:type unknown: list
:returns: None
:rtype: None
... | Compile qt designer files
:param namespace: namespace containing arguments from the launch parser
:type namespace: Namespace
:param unknown: list of unknown arguments
:type unknown: list
:returns: None
:rtype: None
:raises: None | Below is the the instruction that describes the task:
### Input:
Compile qt designer files
:param namespace: namespace containing arguments from the launch parser
:type namespace: Namespace
:param unknown: list of unknown arguments
:type unknown: list
:returns: None
... |
def setAllEntriesFromParList(self, aParList, updateModel=False):
""" Set all the parameter entry values in the GUI to the values
in the given par list. If 'updateModel' is True, the internal
param list will be updated to the new values as well as the GUI
entries (slower and n... | Set all the parameter entry values in the GUI to the values
in the given par list. If 'updateModel' is True, the internal
param list will be updated to the new values as well as the GUI
entries (slower and not always necessary). Note the
corresponding TparDisplay method. | Below is the the instruction that describes the task:
### Input:
Set all the parameter entry values in the GUI to the values
in the given par list. If 'updateModel' is True, the internal
param list will be updated to the new values as well as the GUI
entries (slower and not alway... |
def comment_lines(lines, prefix):
"""Return commented lines"""
if not prefix:
return lines
return [prefix + ' ' + line if line else prefix for line in lines] | Return commented lines | Below is the the instruction that describes the task:
### Input:
Return commented lines
### Response:
def comment_lines(lines, prefix):
"""Return commented lines"""
if not prefix:
return lines
return [prefix + ' ' + line if line else prefix for line in lines] |
def _handle_match(client, channel, nick, message, matches):
""" Match stores all channel info. If helga is asked something to
stimulate a markov response about channel data, then we shall graciously
provide it.
"""
generate_interrogative = _CHANNEL_GENERATE_REGEX.match(message)
if generate_inter... | Match stores all channel info. If helga is asked something to
stimulate a markov response about channel data, then we shall graciously
provide it. | Below is the the instruction that describes the task:
### Input:
Match stores all channel info. If helga is asked something to
stimulate a markov response about channel data, then we shall graciously
provide it.
### Response:
def _handle_match(client, channel, nick, message, matches):
""" Match stores ... |
def read_text(self, text: str) -> bool:
"""
Consume a strlen(text) text at current position in the stream
else return False.
Same as "" in BNF
ex : read_text("ls");.
"""
if self.read_eof():
return False
self._stream.save_context()
if se... | Consume a strlen(text) text at current position in the stream
else return False.
Same as "" in BNF
ex : read_text("ls");. | Below is the the instruction that describes the task:
### Input:
Consume a strlen(text) text at current position in the stream
else return False.
Same as "" in BNF
ex : read_text("ls");.
### Response:
def read_text(self, text: str) -> bool:
"""
Consume a strlen(text) text at... |
def site_cleanup(sender, action, instance, **kwargs):
"""
Make sure there is only a single preferences object per site.
So remove sites from pre-existing preferences objects.
"""
if action == 'post_add':
if isinstance(instance, Preferences) \
and hasattr(instance.__class__, 'obje... | Make sure there is only a single preferences object per site.
So remove sites from pre-existing preferences objects. | Below is the the instruction that describes the task:
### Input:
Make sure there is only a single preferences object per site.
So remove sites from pre-existing preferences objects.
### Response:
def site_cleanup(sender, action, instance, **kwargs):
"""
Make sure there is only a single preferences obje... |
def match(self, filepath):
"""
The function to check file.
Should return True if match, False otherwise.
"""
for pattern in self.__pattern:
if len(fnmatch.filter([filepath], pattern)) > 0:
return True
return False | The function to check file.
Should return True if match, False otherwise. | Below is the the instruction that describes the task:
### Input:
The function to check file.
Should return True if match, False otherwise.
### Response:
def match(self, filepath):
"""
The function to check file.
Should return True if match, False otherwise.
"""
for p... |
def estimate_from_ssr(histograms, readout_povm, channel_ops, settings):
"""
Estimate a density matrix from single shot histograms obtained by measuring bitstrings in
the Z-eigenbasis after application of given channel operators.
:param numpy.ndarray histograms: The single shot histogram... | Estimate a density matrix from single shot histograms obtained by measuring bitstrings in
the Z-eigenbasis after application of given channel operators.
:param numpy.ndarray histograms: The single shot histograms, `shape=(n_channels, dim)`.
:param DiagognalPOVM readout_povm: The POVM correspond... | Below is the the instruction that describes the task:
### Input:
Estimate a density matrix from single shot histograms obtained by measuring bitstrings in
the Z-eigenbasis after application of given channel operators.
:param numpy.ndarray histograms: The single shot histograms, `shape=(n_channels, ... |
def dedup(l, suffix='__', case_sensitive=True):
"""De-duplicates a list of string by suffixing a counter
Always returns the same number of entries as provided, and always returns
unique values. Case sensitive comparison by default.
>>> print(','.join(dedup(['foo', 'bar', 'bar', 'bar', 'Bar'])))
fo... | De-duplicates a list of string by suffixing a counter
Always returns the same number of entries as provided, and always returns
unique values. Case sensitive comparison by default.
>>> print(','.join(dedup(['foo', 'bar', 'bar', 'bar', 'Bar'])))
foo,bar,bar__1,bar__2,Bar
>>> print(','.join(dedup(['... | Below is the the instruction that describes the task:
### Input:
De-duplicates a list of string by suffixing a counter
Always returns the same number of entries as provided, and always returns
unique values. Case sensitive comparison by default.
>>> print(','.join(dedup(['foo', 'bar', 'bar', 'bar', 'B... |
def do_kick(self, send, target, nick, msg, slogan=True):
"""Kick users.
- If kick is disabled, don't do anything.
- If the bot is not a op, rage at a op.
- Kick the user.
"""
if not self.kick_enabled:
return
if target not in self.channels:
... | Kick users.
- If kick is disabled, don't do anything.
- If the bot is not a op, rage at a op.
- Kick the user. | Below is the the instruction that describes the task:
### Input:
Kick users.
- If kick is disabled, don't do anything.
- If the bot is not a op, rage at a op.
- Kick the user.
### Response:
def do_kick(self, send, target, nick, msg, slogan=True):
"""Kick users.
- If kick i... |
def location(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of which part of the email links were clicked from (HTML or Text).
This is only recorded when Link Tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/clicks/location", tag... | Gets an overview of which part of the email links were clicked from (HTML or Text).
This is only recorded when Link Tracking is enabled for that email. | Below is the the instruction that describes the task:
### Input:
Gets an overview of which part of the email links were clicked from (HTML or Text).
This is only recorded when Link Tracking is enabled for that email.
### Response:
def location(self, tag=None, fromdate=None, todate=None):
"""
... |
def _dev_populate_from_json_data(self, json_data):
"""
!! Must only be called once, when empty !!
"""
# workflow
# --------
# (methods belonging to create/update/delete framework:
# epm._dev_populate_from_json_data, table.batch_add, record.update, queryset.de... | !! Must only be called once, when empty !! | Below is the the instruction that describes the task:
### Input:
!! Must only be called once, when empty !!
### Response:
def _dev_populate_from_json_data(self, json_data):
"""
!! Must only be called once, when empty !!
"""
# workflow
# --------
# (methods belonging... |
def print_statement_coverage(self):
"""Display how many of the direct statements have been converted.
Also prints how many are considered 'degenerate' and not converted."""
if not self.all_direct_stmts:
self.get_all_direct_statements()
if not self.degenerate_stmts:
... | Display how many of the direct statements have been converted.
Also prints how many are considered 'degenerate' and not converted. | Below is the the instruction that describes the task:
### Input:
Display how many of the direct statements have been converted.
Also prints how many are considered 'degenerate' and not converted.
### Response:
def print_statement_coverage(self):
"""Display how many of the direct statements have be... |
def device_count(self):
"""
Find amount of CUE devices
:returns: amount of CUE devices
:rtype: int
"""
device_count = get_device_count(self.corsair_sdk)
if device_count == -1:
self._raise_corsair_error()
return device_count | Find amount of CUE devices
:returns: amount of CUE devices
:rtype: int | Below is the the instruction that describes the task:
### Input:
Find amount of CUE devices
:returns: amount of CUE devices
:rtype: int
### Response:
def device_count(self):
"""
Find amount of CUE devices
:returns: amount of CUE devices
:rtype: int
"""
... |
def CreateBlockDeviceMap(self, image_id, instance_type):
"""
If you launch without specifying a manual device block mapping, you may
not get all the ephemeral devices available to the given instance type.
This will build one that ensures all available ephemeral devices are
mapped.
... | If you launch without specifying a manual device block mapping, you may
not get all the ephemeral devices available to the given instance type.
This will build one that ensures all available ephemeral devices are
mapped. | Below is the the instruction that describes the task:
### Input:
If you launch without specifying a manual device block mapping, you may
not get all the ephemeral devices available to the given instance type.
This will build one that ensures all available ephemeral devices are
mapped.
### Respons... |
def print_error_to_io_stream(err: Exception, io: TextIOBase, print_big_traceback : bool = True):
"""
Utility method to print an exception's content to a stream
:param err:
:param io:
:param print_big_traceback:
:return:
"""
if print_big_traceback:
traceback.print_tb(err.__traceb... | Utility method to print an exception's content to a stream
:param err:
:param io:
:param print_big_traceback:
:return: | Below is the the instruction that describes the task:
### Input:
Utility method to print an exception's content to a stream
:param err:
:param io:
:param print_big_traceback:
:return:
### Response:
def print_error_to_io_stream(err: Exception, io: TextIOBase, print_big_traceback : bool = True):
... |
def load(self, txt_fst_file_name):
"""
Save the transducer in the text file format of OpenFST.
The format is specified as follows:
arc format: src dest ilabel olabel [weight]
final state format: state [weight]
lines may occur in any order except initial state must... | Save the transducer in the text file format of OpenFST.
The format is specified as follows:
arc format: src dest ilabel olabel [weight]
final state format: state [weight]
lines may occur in any order except initial state must be first line
Args:
txt_fst_file_n... | Below is the the instruction that describes the task:
### Input:
Save the transducer in the text file format of OpenFST.
The format is specified as follows:
arc format: src dest ilabel olabel [weight]
final state format: state [weight]
lines may occur in any order except init... |
def disambiguate_unit(unit, text):
"""
Resolve ambiguity.
Distinguish between units that have same names, symbols or abbreviations.
"""
new_unit = l.UNITS[unit]
if not new_unit:
new_unit = l.LOWER_UNITS[unit.lower()]
if not new_unit:
raise KeyError('Could not find un... | Resolve ambiguity.
Distinguish between units that have same names, symbols or abbreviations. | Below is the the instruction that describes the task:
### Input:
Resolve ambiguity.
Distinguish between units that have same names, symbols or abbreviations.
### Response:
def disambiguate_unit(unit, text):
"""
Resolve ambiguity.
Distinguish between units that have same names, symbols or abbrevia... |
def _iter_member_elms(self):
"""
Generate each child of the ``<p:spTree>`` element that corresponds to
a shape, in the sequence they appear in the XML.
"""
for shape_elm in self._spTree.iter_shape_elms():
if self._is_member_elm(shape_elm):
yield shape_... | Generate each child of the ``<p:spTree>`` element that corresponds to
a shape, in the sequence they appear in the XML. | Below is the the instruction that describes the task:
### Input:
Generate each child of the ``<p:spTree>`` element that corresponds to
a shape, in the sequence they appear in the XML.
### Response:
def _iter_member_elms(self):
"""
Generate each child of the ``<p:spTree>`` element that corre... |
def full_load(self):
"""Process the data directories.
This method will load the data directories which might not have
been loaded if the "fast_load" option was used.
"""
self.parse_data_directories()
class RichHeader(object):
pass
rich_header = self... | Process the data directories.
This method will load the data directories which might not have
been loaded if the "fast_load" option was used. | Below is the the instruction that describes the task:
### Input:
Process the data directories.
This method will load the data directories which might not have
been loaded if the "fast_load" option was used.
### Response:
def full_load(self):
"""Process the data directories.
This m... |
def log_info(self, logger):
"""Print statistical information via the provided logger
Parameters
----------
logger : logging.Logger
logger created using logging.getLogger()
"""
logger.info('#words in training set: %d' % self._words_in_train_data)
logge... | Print statistical information via the provided logger
Parameters
----------
logger : logging.Logger
logger created using logging.getLogger() | Below is the the instruction that describes the task:
### Input:
Print statistical information via the provided logger
Parameters
----------
logger : logging.Logger
logger created using logging.getLogger()
### Response:
def log_info(self, logger):
"""Print statistical i... |
def update_frame(self, key, ranges=None, element=None):
"""
Update the internal state of the Plot to represent the given
key tuple (where integers represent frames). Returns this
state.
"""
reused = isinstance(self.hmap, DynamicMap) and self.overlaid
if not reused... | Update the internal state of the Plot to represent the given
key tuple (where integers represent frames). Returns this
state. | Below is the the instruction that describes the task:
### Input:
Update the internal state of the Plot to represent the given
key tuple (where integers represent frames). Returns this
state.
### Response:
def update_frame(self, key, ranges=None, element=None):
"""
Update the interna... |
def run(command, parser, cl_args, unknown_args):
'''
:param command:
:param parser:
:param cl_args:
:param unknown_args:
:return:
'''
Log.debug("Deactivate Args: %s", cl_args)
return cli_helper.run(command, cl_args, "deactivate topology") | :param command:
:param parser:
:param cl_args:
:param unknown_args:
:return: | Below is the the instruction that describes the task:
### Input:
:param command:
:param parser:
:param cl_args:
:param unknown_args:
:return:
### Response:
def run(command, parser, cl_args, unknown_args):
'''
:param command:
:param parser:
:param cl_args:
:param unknown_args:
:return:
'''
L... |
def getmacbyip6(ip6, chainCC=0):
"""
Returns the mac address to be used for provided 'ip6' peer.
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to sending function
use... | Returns the mac address to be used for provided 'ip6' peer.
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to sending function
used to perform the resolution, if needed) | Below is the the instruction that describes the task:
### Input:
Returns the mac address to be used for provided 'ip6' peer.
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to s... |
def set_heat_pump_mode(self, device_label, mode):
""" Set heatpump mode
Args:
mode (str): 'HEAT', 'COOL', 'FAN' or 'AUTO'
"""
response = None
try:
response = requests.put(
urls.set_heatpump_state(self._giid, device_label),
h... | Set heatpump mode
Args:
mode (str): 'HEAT', 'COOL', 'FAN' or 'AUTO' | Below is the the instruction that describes the task:
### Input:
Set heatpump mode
Args:
mode (str): 'HEAT', 'COOL', 'FAN' or 'AUTO'
### Response:
def set_heat_pump_mode(self, device_label, mode):
""" Set heatpump mode
Args:
mode (str): 'HEAT', 'COOL', 'FAN' or 'AUTO... |
def passes_filter(self, user):
''' Returns true if the condition passes the filter '''
cls = type(self.condition)
qs = cls.objects.filter(pk=self.condition.id)
return self.condition in self.pre_filter(qs, user) | Returns true if the condition passes the filter | Below is the the instruction that describes the task:
### Input:
Returns true if the condition passes the filter
### Response:
def passes_filter(self, user):
''' Returns true if the condition passes the filter '''
cls = type(self.condition)
qs = cls.objects.filter(pk=self.condition.id)
... |
def absolute_uri(self, location=None, scheme=None, **query):
"""Builds an absolute URI from ``location`` and variables
available in this request.
If no ``location`` is specified, the relative URI is built from
:meth:`full_path`.
"""
if not is_absolute_uri(location):
... | Builds an absolute URI from ``location`` and variables
available in this request.
If no ``location`` is specified, the relative URI is built from
:meth:`full_path`. | Below is the the instruction that describes the task:
### Input:
Builds an absolute URI from ``location`` and variables
available in this request.
If no ``location`` is specified, the relative URI is built from
:meth:`full_path`.
### Response:
def absolute_uri(self, location=None, scheme=N... |
def push_san(self, san: str) -> Move:
"""
Parses a move in standard algebraic notation, makes the move and puts
it on the the move stack.
Returns the move.
:raises: :exc:`ValueError` if neither legal nor a null move.
"""
move = self.parse_san(san)
self.p... | Parses a move in standard algebraic notation, makes the move and puts
it on the the move stack.
Returns the move.
:raises: :exc:`ValueError` if neither legal nor a null move. | Below is the the instruction that describes the task:
### Input:
Parses a move in standard algebraic notation, makes the move and puts
it on the the move stack.
Returns the move.
:raises: :exc:`ValueError` if neither legal nor a null move.
### Response:
def push_san(self, san: str) -> Mov... |
def case_variants(*elements):
"""
For configs which take case-insensitive options, it is necessary to extend the list with
various common case variants (all combinations are not practical). In the future, this should
be removed, when parser filters are made case-insensitive.
Args:
*elements... | For configs which take case-insensitive options, it is necessary to extend the list with
various common case variants (all combinations are not practical). In the future, this should
be removed, when parser filters are made case-insensitive.
Args:
*elements (str): list of elements which need case-s... | Below is the the instruction that describes the task:
### Input:
For configs which take case-insensitive options, it is necessary to extend the list with
various common case variants (all combinations are not practical). In the future, this should
be removed, when parser filters are made case-insensitive.
... |
def generate_cutV_genomic_CDR3_segs(self):
"""Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline V segments so that delV can index directly for number of
nucleotides to delete from a segment.
... | Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline V segments so that delV can index directly for number of
nucleotides to delete from a segment.
Sets the attribute cutV_genomic_CDR3_se... | Below is the the instruction that describes the task:
### Input:
Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline V segments so that delV can index directly for number of
nucleotides to delete fro... |
def run_cell_magic(self, magic_name, line, cell):
"""Execute the given cell magic.
Parameters
----------
magic_name : str
Name of the desired magic function, without '%' prefix.
line : str
The rest of the first input line as a single string.
... | Execute the given cell magic.
Parameters
----------
magic_name : str
Name of the desired magic function, without '%' prefix.
line : str
The rest of the first input line as a single string.
cell : str
The body of the cell as a (possibly mul... | Below is the the instruction that describes the task:
### Input:
Execute the given cell magic.
Parameters
----------
magic_name : str
Name of the desired magic function, without '%' prefix.
line : str
The rest of the first input line as a single string.
... |
def inline_image(image, mime_type=None, dst_color=None, src_color=None, spacing=None, collapse_x=None, collapse_y=None):
"""
Embeds the contents of a file directly inside your stylesheet, eliminating
the need for another HTTP request. For small files such images or fonts,
this can be a performance benef... | Embeds the contents of a file directly inside your stylesheet, eliminating
the need for another HTTP request. For small files such images or fonts,
this can be a performance benefit at the cost of a larger generated CSS
file. | Below is the the instruction that describes the task:
### Input:
Embeds the contents of a file directly inside your stylesheet, eliminating
the need for another HTTP request. For small files such images or fonts,
this can be a performance benefit at the cost of a larger generated CSS
file.
### Response:... |
def incorporate(self, other_user):
"""Incorporate all enrollments and goals performed by the other user
If this user is not enrolled in a given experiment, the results for the
other user are incorporated. For experiments this user is already
enrolled in the results of the other user are... | Incorporate all enrollments and goals performed by the other user
If this user is not enrolled in a given experiment, the results for the
other user are incorporated. For experiments this user is already
enrolled in the results of the other user are discarded.
This takes a relatively l... | Below is the the instruction that describes the task:
### Input:
Incorporate all enrollments and goals performed by the other user
If this user is not enrolled in a given experiment, the results for the
other user are incorporated. For experiments this user is already
enrolled in the result... |
def request_check(client, exception, *msg_parms, **kwargs):
"""Make blocking request to client and raise exception if reply is not ok.
Parameters
----------
client : DeviceClient instance
exception: Exception class to raise
*msg_parms : Message parameters sent to the Message.request() call
... | Make blocking request to client and raise exception if reply is not ok.
Parameters
----------
client : DeviceClient instance
exception: Exception class to raise
*msg_parms : Message parameters sent to the Message.request() call
**kwargs : Keyword arguments
Forwards kwargs['timeout'] to ... | Below is the the instruction that describes the task:
### Input:
Make blocking request to client and raise exception if reply is not ok.
Parameters
----------
client : DeviceClient instance
exception: Exception class to raise
*msg_parms : Message parameters sent to the Message.request() call
... |
def split_by_idx(idxs, *a):
"""
Split each array passed as *a, to a pair of arrays like this (elements selected by idxs, the remaining elements)
This can be used to split multiple arrays containing training data to validation and training set.
:param idxs [int]: list of indexes selected
:param a l... | Split each array passed as *a, to a pair of arrays like this (elements selected by idxs, the remaining elements)
This can be used to split multiple arrays containing training data to validation and training set.
:param idxs [int]: list of indexes selected
:param a list: list of np.array, each array should... | Below is the the instruction that describes the task:
### Input:
Split each array passed as *a, to a pair of arrays like this (elements selected by idxs, the remaining elements)
This can be used to split multiple arrays containing training data to validation and training set.
:param idxs [int]: list of in... |
def cancelMarketDepth(self, contracts=None):
"""
Cancel streaming market data for contract
https://www.interactivebrokers.com/en/software/api/apiguide/java/cancelmktdepth.htm
"""
if contracts == None:
contracts = list(self.contracts.values())
elif not isinstan... | Cancel streaming market data for contract
https://www.interactivebrokers.com/en/software/api/apiguide/java/cancelmktdepth.htm | Below is the the instruction that describes the task:
### Input:
Cancel streaming market data for contract
https://www.interactivebrokers.com/en/software/api/apiguide/java/cancelmktdepth.htm
### Response:
def cancelMarketDepth(self, contracts=None):
"""
Cancel streaming market data for cont... |
def getChildren(self, name=None, ns=None):
"""
Get a list of children by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: ... | Get a list of children by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: (I{prefix}, I{name})
@return: The list of matching chil... | Below is the the instruction that describes the task:
### Input:
Get a list of children by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@typ... |
def get_applicable_variables(self, ds):
'''
Returns a list of variable names that are applicable to ACDD Metadata
Checks for variables. This includes geophysical and coordinate
variables only.
:param netCDF4.Dataset ds: An open netCDF dataset
'''
if self._applica... | Returns a list of variable names that are applicable to ACDD Metadata
Checks for variables. This includes geophysical and coordinate
variables only.
:param netCDF4.Dataset ds: An open netCDF dataset | Below is the the instruction that describes the task:
### Input:
Returns a list of variable names that are applicable to ACDD Metadata
Checks for variables. This includes geophysical and coordinate
variables only.
:param netCDF4.Dataset ds: An open netCDF dataset
### Response:
def get_appl... |
def full_info(**kwargs):
'''
Return the node_info, vm_info and freemem
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to c... | Return the node_info, vm_info and freemem
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to connect with, overriding defaults
... | Below is the the instruction that describes the task:
### Input:
Return the node_info, vm_info and freemem
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
... |
def run_license_checker(config_path):
# type: (str) -> None
"""Generate table of installed packages and check for license
warnings based off user defined restricted license values.
:param config_path: str
:return:
"""
whitelist_licenses = _get_whitelist_licenses(config_path)
table = Pri... | Generate table of installed packages and check for license
warnings based off user defined restricted license values.
:param config_path: str
:return: | Below is the the instruction that describes the task:
### Input:
Generate table of installed packages and check for license
warnings based off user defined restricted license values.
:param config_path: str
:return:
### Response:
def run_license_checker(config_path):
# type: (str) -> None
"""G... |
def _hexdecode(hexstring):
"""Convert a hex encoded string to a byte string.
For example '4A' will return 'J', and '04' will return ``'\\x04'`` (which has length 1).
Args:
hexstring (str): Can be for example 'A3' or 'A3B4'. Must be of even length.
Allowed characters are '0' to '9', 'a' to ... | Convert a hex encoded string to a byte string.
For example '4A' will return 'J', and '04' will return ``'\\x04'`` (which has length 1).
Args:
hexstring (str): Can be for example 'A3' or 'A3B4'. Must be of even length.
Allowed characters are '0' to '9', 'a' to 'f' and 'A' to 'F' (not space).
... | Below is the the instruction that describes the task:
### Input:
Convert a hex encoded string to a byte string.
For example '4A' will return 'J', and '04' will return ``'\\x04'`` (which has length 1).
Args:
hexstring (str): Can be for example 'A3' or 'A3B4'. Must be of even length.
Allowed... |
def binaryFiles(self, path, minPartitions=None):
"""
.. note:: Experimental
Read a directory of binary files from HDFS, a local file system
(available on all nodes), or any Hadoop-supported file system URI
as a byte array. Each file is read as a single record and returned
... | .. note:: Experimental
Read a directory of binary files from HDFS, a local file system
(available on all nodes), or any Hadoop-supported file system URI
as a byte array. Each file is read as a single record and returned
in a key-value pair, where the key is the path of each file, the
... | Below is the the instruction that describes the task:
### Input:
.. note:: Experimental
Read a directory of binary files from HDFS, a local file system
(available on all nodes), or any Hadoop-supported file system URI
as a byte array. Each file is read as a single record and returned
... |
def cmp(self,junc,tolerance=0):
""" output comparison and allow for tolerance if desired
* -1 if junc comes before self
* 1 if junc comes after self
* 0 if overlaps
* 2 if else
:param junc:
:param tolerance: optional search space (default=0, no tolerance)
:type junc: Junction
:type... | output comparison and allow for tolerance if desired
* -1 if junc comes before self
* 1 if junc comes after self
* 0 if overlaps
* 2 if else
:param junc:
:param tolerance: optional search space (default=0, no tolerance)
:type junc: Junction
:type tolerance: int
:return: value of co... | Below is the the instruction that describes the task:
### Input:
output comparison and allow for tolerance if desired
* -1 if junc comes before self
* 1 if junc comes after self
* 0 if overlaps
* 2 if else
:param junc:
:param tolerance: optional search space (default=0, no tolerance)
:... |
def read_table(fstream):
"""
Read a likwid table info from the text stream.
Args:
fstream: Likwid's filestream.
Returns (dict(str: str)):
A dict containing likwid's table info as key/value pairs.
"""
pos = fstream.tell()
line = fstream.readline().strip()
fragments = lin... | Read a likwid table info from the text stream.
Args:
fstream: Likwid's filestream.
Returns (dict(str: str)):
A dict containing likwid's table info as key/value pairs. | Below is the the instruction that describes the task:
### Input:
Read a likwid table info from the text stream.
Args:
fstream: Likwid's filestream.
Returns (dict(str: str)):
A dict containing likwid's table info as key/value pairs.
### Response:
def read_table(fstream):
"""
Read a... |
def phrase_contains_special_keys(expansion: model.Expansion) -> bool:
"""
Determine if the expansion contains any special keys, including those resulting from any processed macros
(<script>, <file>, etc). If any are found, the phrase cannot be undone.
Python Zen: »In the face of ambigui... | Determine if the expansion contains any special keys, including those resulting from any processed macros
(<script>, <file>, etc). If any are found, the phrase cannot be undone.
Python Zen: »In the face of ambiguity, refuse the temptation to guess.«
The question 'What does the phrase expansion ... | Below is the the instruction that describes the task:
### Input:
Determine if the expansion contains any special keys, including those resulting from any processed macros
(<script>, <file>, etc). If any are found, the phrase cannot be undone.
Python Zen: »In the face of ambiguity, refuse the tempta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.