code stringlengths 75 104k | docstring stringlengths 1 46.9k | text stringlengths 164 112k |
|---|---|---|
def stop(self, wait_for_completion=True, operation_timeout=None,
status_timeout=None, allow_status_exceptions=False):
"""
Stop this LPAR, using the HMC operation "Stop Logical
Partition". The stop operation stops the processors from
processing instructions.
This HMC... | Stop this LPAR, using the HMC operation "Stop Logical
Partition". The stop operation stops the processors from
processing instructions.
This HMC operation has deferred status behavior: If the asynchronous
job on the HMC is complete, it takes a few seconds until the LPAR
status h... | Below is the the instruction that describes the task:
### Input:
Stop this LPAR, using the HMC operation "Stop Logical
Partition". The stop operation stops the processors from
processing instructions.
This HMC operation has deferred status behavior: If the asynchronous
job on the HM... |
def make_srcmap(psf, exp, spatial_model, sigma, npix=500, xpix=0.0, ypix=0.0,
cdelt=0.01, psf_scale_fn=None, klims=None, sparse=False):
"""Compute the source map for a given spatial model.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
exp : `~numpy.ndarray`
Array of ... | Compute the source map for a given spatial model.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
exp : `~numpy.ndarray`
Array of exposures.
spatial_model : str
Spatial model.
sigma : float
Spatial size parameter for extended models.
xpix : float
Sou... | Below is the the instruction that describes the task:
### Input:
Compute the source map for a given spatial model.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
exp : `~numpy.ndarray`
Array of exposures.
spatial_model : str
Spatial model.
sigma : float
Spat... |
def register_saver_ops(self):
"""
Registers the saver operations to the graph in context.
"""
variables = self.get_savable_variables()
if variables is None or len(variables) == 0:
self._saver = None
return
base_scope = self._get_base_variable_sco... | Registers the saver operations to the graph in context. | Below is the the instruction that describes the task:
### Input:
Registers the saver operations to the graph in context.
### Response:
def register_saver_ops(self):
"""
Registers the saver operations to the graph in context.
"""
variables = self.get_savable_variables()
if v... |
def vrrpe_spf_basic(self, **kwargs):
"""Set vrrpe short path forwarding to default.
Args:
int_type (str): Type of interface. (gigabitethernet,
tengigabitethernet, etc).
name (str): Name of interface. (1/0/5, 1/0/10, etc).
enable (bool): If vrrpe short... | Set vrrpe short path forwarding to default.
Args:
int_type (str): Type of interface. (gigabitethernet,
tengigabitethernet, etc).
name (str): Name of interface. (1/0/5, 1/0/10, etc).
enable (bool): If vrrpe short path fowarding should be enabled
... | Below is the the instruction that describes the task:
### Input:
Set vrrpe short path forwarding to default.
Args:
int_type (str): Type of interface. (gigabitethernet,
tengigabitethernet, etc).
name (str): Name of interface. (1/0/5, 1/0/10, etc).
enable (... |
def mkdir(name, path):
'''Create an empty directory in the virtual folder.
\b
NAME: Name of a virtual folder.
PATH: The name or path of directory. Parent directories are created automatically
if they do not exist.
'''
with Session() as session:
try:
session.VFolder... | Create an empty directory in the virtual folder.
\b
NAME: Name of a virtual folder.
PATH: The name or path of directory. Parent directories are created automatically
if they do not exist. | Below is the the instruction that describes the task:
### Input:
Create an empty directory in the virtual folder.
\b
NAME: Name of a virtual folder.
PATH: The name or path of directory. Parent directories are created automatically
if they do not exist.
### Response:
def mkdir(name, path):
... |
def get_HDX_code_from_location(location, locations=None, configuration=None):
# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Optional[str]
"""Get HDX code for location
Args:
location (str): Location for which to get HDX code
locations (Optional[List[Dict... | Get HDX code for location
Args:
location (str): Location for which to get HDX code
locations (Optional[List[Dict]]): Valid locations list. Defaults to list downloaded from HDX.
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration.
... | Below is the the instruction that describes the task:
### Input:
Get HDX code for location
Args:
location (str): Location for which to get HDX code
locations (Optional[List[Dict]]): Valid locations list. Defaults to list downloaded from HDX.
configuration (Optional[Confi... |
def fn_with_custom_grad(grad_fn, use_global_vars=False):
"""Decorator to create a subgraph with a custom gradient function.
The subgraph created by the decorated function is NOT put in a Defun and so
does not suffer from the limitations of the Defun (all subgraph ops on the
same device, no summaries).
Args:... | Decorator to create a subgraph with a custom gradient function.
The subgraph created by the decorated function is NOT put in a Defun and so
does not suffer from the limitations of the Defun (all subgraph ops on the
same device, no summaries).
Args:
grad_fn: function with signature
(inputs, variables... | Below is the the instruction that describes the task:
### Input:
Decorator to create a subgraph with a custom gradient function.
The subgraph created by the decorated function is NOT put in a Defun and so
does not suffer from the limitations of the Defun (all subgraph ops on the
same device, no summaries).
... |
def delete_account_metadata(self, prefix=None):
"""
Removes all metadata matching the specified prefix from the account.
By default, the standard account metadata prefix ('X-Account-Meta-') is
prepended to the header name if it isn't present. For non-standard
headers, you must i... | Removes all metadata matching the specified prefix from the account.
By default, the standard account metadata prefix ('X-Account-Meta-') is
prepended to the header name if it isn't present. For non-standard
headers, you must include a non-None prefix, such as an empty string. | Below is the the instruction that describes the task:
### Input:
Removes all metadata matching the specified prefix from the account.
By default, the standard account metadata prefix ('X-Account-Meta-') is
prepended to the header name if it isn't present. For non-standard
headers, you must ... |
def _load_unicode_block_info(self):
"""
Function for parsing the Unicode block info from the Unicode Character
Database (UCD) and generating a lookup table. For more info on the UCD,
see the following website: https://www.unicode.org/ucd/
"""
filename = "Blocks.txt"
... | Function for parsing the Unicode block info from the Unicode Character
Database (UCD) and generating a lookup table. For more info on the UCD,
see the following website: https://www.unicode.org/ucd/ | Below is the the instruction that describes the task:
### Input:
Function for parsing the Unicode block info from the Unicode Character
Database (UCD) and generating a lookup table. For more info on the UCD,
see the following website: https://www.unicode.org/ucd/
### Response:
def _load_unicode_bl... |
def absent(name,
vhost='/',
runas=None):
'''
Ensure the named policy is absent
Reference: http://www.rabbitmq.com/ha.html
name
The name of the policy to remove
runas
Name of the user to run the command as
'''
ret = {'name': name, 'result': True, 'comme... | Ensure the named policy is absent
Reference: http://www.rabbitmq.com/ha.html
name
The name of the policy to remove
runas
Name of the user to run the command as | Below is the the instruction that describes the task:
### Input:
Ensure the named policy is absent
Reference: http://www.rabbitmq.com/ha.html
name
The name of the policy to remove
runas
Name of the user to run the command as
### Response:
def absent(name,
vhost='/',
... |
def get_num_words(text):
"""
Counts and returns the number of words found in a given text
:param text:
:return:
"""
try:
word_regexp_pattern = re.compile(r"[a-zA-Záéíóúñ]+")
num_words = re.findall(word_regexp_pattern, text)
return len(num_words)
except TypeError:
... | Counts and returns the number of words found in a given text
:param text:
:return: | Below is the the instruction that describes the task:
### Input:
Counts and returns the number of words found in a given text
:param text:
:return:
### Response:
def get_num_words(text):
"""
Counts and returns the number of words found in a given text
:param text:
:return:
"""
try... |
def open(self, flag="c"):
"""Open handle
set protocol=2 to fix python3
.. versionadded:: 1.3.1
"""
return shelve.open(os.path.join(gettempdir(), self.index), flag=flag, protocol=2) | Open handle
set protocol=2 to fix python3
.. versionadded:: 1.3.1 | Below is the the instruction that describes the task:
### Input:
Open handle
set protocol=2 to fix python3
.. versionadded:: 1.3.1
### Response:
def open(self, flag="c"):
"""Open handle
set protocol=2 to fix python3
.. versionadded:: 1.3.1
"""
return shel... |
def require_fresh_games(self, number_fresh):
"""Require a given number of fresh games to be played.
Args:
number_fresh: integer, number of new fresh games needed
Increments the cell `table_state=metadata:wait_for_game_number`
by the given number of games. This will cause
... | Require a given number of fresh games to be played.
Args:
number_fresh: integer, number of new fresh games needed
Increments the cell `table_state=metadata:wait_for_game_number`
by the given number of games. This will cause
`self.wait_for_fresh_games()` to block until the g... | Below is the the instruction that describes the task:
### Input:
Require a given number of fresh games to be played.
Args:
number_fresh: integer, number of new fresh games needed
Increments the cell `table_state=metadata:wait_for_game_number`
by the given number of games. This ... |
def with_name(self, name):
"""Sets the name scope for future operations."""
self._head = self._head.with_name(name)
return self | Sets the name scope for future operations. | Below is the the instruction that describes the task:
### Input:
Sets the name scope for future operations.
### Response:
def with_name(self, name):
"""Sets the name scope for future operations."""
self._head = self._head.with_name(name)
return self |
def delete(self):
r"""Delete this node from the parse tree.
Where applicable, this will remove all descendants of this node from
the parse tree.
>>> from TexSoup import TexSoup
>>> soup = TexSoup(r'''\textit{\color{blue}{Silly}}\textit{keep me!}''')
>>> soup.textit.colo... | r"""Delete this node from the parse tree.
Where applicable, this will remove all descendants of this node from
the parse tree.
>>> from TexSoup import TexSoup
>>> soup = TexSoup(r'''\textit{\color{blue}{Silly}}\textit{keep me!}''')
>>> soup.textit.color.delete()
>>> sou... | Below is the the instruction that describes the task:
### Input:
r"""Delete this node from the parse tree.
Where applicable, this will remove all descendants of this node from
the parse tree.
>>> from TexSoup import TexSoup
>>> soup = TexSoup(r'''\textit{\color{blue}{Silly}}\textit... |
def upload(self, fp, token=None, target_name=None, content_type=None):
"""
Upload a file to Zendesk.
:param fp: file object, StringIO instance, content, or file path to be
uploaded
:param token: upload token for uploading multiple files
:param target_name: nam... | Upload a file to Zendesk.
:param fp: file object, StringIO instance, content, or file path to be
uploaded
:param token: upload token for uploading multiple files
:param target_name: name of the file inside Zendesk
:return: :class:`Upload` object containing a token and... | Below is the the instruction that describes the task:
### Input:
Upload a file to Zendesk.
:param fp: file object, StringIO instance, content, or file path to be
uploaded
:param token: upload token for uploading multiple files
:param target_name: name of the file inside Z... |
def consume(consumer_id):
"""Given an existing consumer ID, return any new lines from the
log since the last time the consumer was consumed."""
global _consumers
consumer = _consumers[consumer_id]
client = get_docker_client()
try:
status = client.inspect_container(consumer.container_id)... | Given an existing consumer ID, return any new lines from the
log since the last time the consumer was consumed. | Below is the the instruction that describes the task:
### Input:
Given an existing consumer ID, return any new lines from the
log since the last time the consumer was consumed.
### Response:
def consume(consumer_id):
"""Given an existing consumer ID, return any new lines from the
log since the last tim... |
def cookie_set(self, name, value):
"""
Set the value of a client cookie. This can only be called while
headers can be sent.
:param str name: The name of the cookie value to set.
:param str value: The value of the cookie to set.
"""
if not self.headers_active:
raise RuntimeError('headers have already b... | Set the value of a client cookie. This can only be called while
headers can be sent.
:param str name: The name of the cookie value to set.
:param str value: The value of the cookie to set. | Below is the the instruction that describes the task:
### Input:
Set the value of a client cookie. This can only be called while
headers can be sent.
:param str name: The name of the cookie value to set.
:param str value: The value of the cookie to set.
### Response:
def cookie_set(self, name, value):
"""... |
def add_hours(self, datetimestr, n):
"""Returns a time that n hours after a time.
:param datetimestr: a datetime object or a datetime str
:param n: number of hours, value can be negative
**中文文档**
返回给定日期N小时之后的时间。
"""
a_datetime = self.parse_datetime(datetimestr)... | Returns a time that n hours after a time.
:param datetimestr: a datetime object or a datetime str
:param n: number of hours, value can be negative
**中文文档**
返回给定日期N小时之后的时间。 | Below is the the instruction that describes the task:
### Input:
Returns a time that n hours after a time.
:param datetimestr: a datetime object or a datetime str
:param n: number of hours, value can be negative
**中文文档**
返回给定日期N小时之后的时间。
### Response:
def add_hours(self, datetimes... |
def create_hpx(cls, nside, nest, coordsys='CEL', order=-1, ebins=None,
region=None, conv=HPX_Conv('FGST_CCUBE'), pixels=None):
"""Create a HPX object.
Parameters
----------
nside : int
HEALPix nside paramter
nest : bool
True for H... | Create a HPX object.
Parameters
----------
nside : int
HEALPix nside paramter
nest : bool
True for HEALPix "NESTED" indexing scheme, False for "RING" scheme.
coordsys : str
"CEL" or "GAL"
order : int
nside = 2**ord... | Below is the the instruction that describes the task:
### Input:
Create a HPX object.
Parameters
----------
nside : int
HEALPix nside paramter
nest : bool
True for HEALPix "NESTED" indexing scheme, False for "RING" scheme.
coordsys : str
... |
def _endless_page(self, number, label=None):
"""Factory function that returns a *EndlessPage* instance.
This method works just like a partial constructor.
"""
return EndlessPage(
self._request,
number,
self._page.number,
len(self),
... | Factory function that returns a *EndlessPage* instance.
This method works just like a partial constructor. | Below is the the instruction that describes the task:
### Input:
Factory function that returns a *EndlessPage* instance.
This method works just like a partial constructor.
### Response:
def _endless_page(self, number, label=None):
"""Factory function that returns a *EndlessPage* instance.
... |
def next(self):
"""Go one token ahead and return the old one"""
rv = self.current
if self._pushed:
self.current = self._pushed.popleft()
elif self.current.type is not TOKEN_EOF:
try:
self.current = self._next()
except StopIteration:
... | Go one token ahead and return the old one | Below is the the instruction that describes the task:
### Input:
Go one token ahead and return the old one
### Response:
def next(self):
"""Go one token ahead and return the old one"""
rv = self.current
if self._pushed:
self.current = self._pushed.popleft()
elif self.cur... |
def plot(self, sizescale=10, color=None, alpha=0.5, label=None, edgecolor='none', **kw):
'''
Plot the ra and dec of the coordinates,
at a given epoch, scaled by their magnitude.
(This does *not* create a new empty figure.)
Parameters
----------
sizescale : (opti... | Plot the ra and dec of the coordinates,
at a given epoch, scaled by their magnitude.
(This does *not* create a new empty figure.)
Parameters
----------
sizescale : (optional) float
The marker size for scatter for a star at the magnitudelimit.
color : (option... | Below is the the instruction that describes the task:
### Input:
Plot the ra and dec of the coordinates,
at a given epoch, scaled by their magnitude.
(This does *not* create a new empty figure.)
Parameters
----------
sizescale : (optional) float
The marker size ... |
def _get_updated_values(before_values, after_values):
""" Get updated values from 2 dicts of values
Args:
before_values (dict): values before update
after_values (dict): values after update
Returns:
dict: a diff dict with key is field key, value is tuple of
(before_va... | Get updated values from 2 dicts of values
Args:
before_values (dict): values before update
after_values (dict): values after update
Returns:
dict: a diff dict with key is field key, value is tuple of
(before_value, after_value) | Below is the the instruction that describes the task:
### Input:
Get updated values from 2 dicts of values
Args:
before_values (dict): values before update
after_values (dict): values after update
Returns:
dict: a diff dict with key is field key, value is tuple of
(be... |
def open(self):
'''Opens the stream for reading.'''
options = copy(self.__options)
# Get scheme and format if not already given
compression = None
if self.__scheme is None or self.__format is None:
detected_scheme, detected_format = helpers.detect_scheme_and_format(s... | Opens the stream for reading. | Below is the the instruction that describes the task:
### Input:
Opens the stream for reading.
### Response:
def open(self):
'''Opens the stream for reading.'''
options = copy(self.__options)
# Get scheme and format if not already given
compression = None
if self.__scheme i... |
def initialize(
self, M_c, M_r, T, seed, initialization=b'from_the_prior',
row_initialization=-1, n_chains=1,
ROW_CRP_ALPHA_GRID=(), COLUMN_CRP_ALPHA_GRID=(),
S_GRID=(), MU_GRID=(), N_GRID=31,):
"""Sample a latent state from prior.
T, list of lists:
... | Sample a latent state from prior.
T, list of lists:
The data table in mapped representation (all floats, generated
by data_utils.read_data_objects)
:returns: X_L, X_D -- the latent state | Below is the the instruction that describes the task:
### Input:
Sample a latent state from prior.
T, list of lists:
The data table in mapped representation (all floats, generated
by data_utils.read_data_objects)
:returns: X_L, X_D -- the latent state
### Response:
def ini... |
def reindex_variables(
variables: Mapping[Any, Variable],
sizes: Mapping[Any, int],
indexes: Mapping[Any, pd.Index],
indexers: Mapping,
method: Optional[str] = None,
tolerance: Any = None,
copy: bool = True,
) -> 'Tuple[OrderedDict[Any, Variable], OrderedDict[Any, pd.Index]]':
"""Conform... | Conform a dictionary of aligned variables onto a new set of variables,
filling in missing values with NaN.
Not public API.
Parameters
----------
variables : dict-like
Dictionary of xarray.Variable objects.
sizes : dict-like
Dictionary from dimension names to integer sizes.
... | Below is the the instruction that describes the task:
### Input:
Conform a dictionary of aligned variables onto a new set of variables,
filling in missing values with NaN.
Not public API.
Parameters
----------
variables : dict-like
Dictionary of xarray.Variable objects.
sizes : dic... |
def deserialize_json(cls, serialized_json):
'''Return a macaroon deserialized from a string
@param serialized_json The string to decode {str}
@return {Macaroon}
'''
serialized = json.loads(serialized_json)
return Macaroon.from_dict(serialized) | Return a macaroon deserialized from a string
@param serialized_json The string to decode {str}
@return {Macaroon} | Below is the the instruction that describes the task:
### Input:
Return a macaroon deserialized from a string
@param serialized_json The string to decode {str}
@return {Macaroon}
### Response:
def deserialize_json(cls, serialized_json):
'''Return a macaroon deserialized from a string
... |
def useradd(pwfile, user, password, opts='', runas=None):
'''
Add a user to htpasswd file using the htpasswd command. If the htpasswd
file does not exist, it will be created.
pwfile
Path to htpasswd file
user
User name
password
User password
opts
Valid opt... | Add a user to htpasswd file using the htpasswd command. If the htpasswd
file does not exist, it will be created.
pwfile
Path to htpasswd file
user
User name
password
User password
opts
Valid options that can be passed are:
- `n` Don't update file; di... | Below is the the instruction that describes the task:
### Input:
Add a user to htpasswd file using the htpasswd command. If the htpasswd
file does not exist, it will be created.
pwfile
Path to htpasswd file
user
User name
password
User password
opts
Valid opti... |
def _validate_enum(self, item: Any, enum: Any) -> Any:
"""Validate enum parameter of method in subclasses of BaseProvider.
:param item: Item of enum object.
:param enum: Enum object.
:return: Value of item.
:raises NonEnumerableError: if ``item`` not in ``enum``.
"""
... | Validate enum parameter of method in subclasses of BaseProvider.
:param item: Item of enum object.
:param enum: Enum object.
:return: Value of item.
:raises NonEnumerableError: if ``item`` not in ``enum``. | Below is the the instruction that describes the task:
### Input:
Validate enum parameter of method in subclasses of BaseProvider.
:param item: Item of enum object.
:param enum: Enum object.
:return: Value of item.
:raises NonEnumerableError: if ``item`` not in ``enum``.
### Response... |
def _escape_xref(xref_match):
"""Escape things that need to be escaped if they're in a cross-reference.
"""
xref = xref_match.group()
xref = xref.replace('/', '%2F')
xref = xref.replace('?', '%3F')
xref = xref.replace('#', '%23')
return xref | Escape things that need to be escaped if they're in a cross-reference. | Below is the the instruction that describes the task:
### Input:
Escape things that need to be escaped if they're in a cross-reference.
### Response:
def _escape_xref(xref_match):
"""Escape things that need to be escaped if they're in a cross-reference.
"""
xref = xref_match.group()
xref = xref.rep... |
def extended_path(self):
"""
Add prefix \\?\ to every absolute path, so that it's a "extended-length"
path, that should be longer than 259 characters (called: "MAX_PATH")
see:
https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath
"""
if self.is_absolute()... | Add prefix \\?\ to every absolute path, so that it's a "extended-length"
path, that should be longer than 259 characters (called: "MAX_PATH")
see:
https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath | Below is the the instruction that describes the task:
### Input:
Add prefix \\?\ to every absolute path, so that it's a "extended-length"
path, that should be longer than 259 characters (called: "MAX_PATH")
see:
https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath
### Response:
de... |
def ClosureTable(model_class, foreign_key=None, referencing_class=None,
referencing_key=None):
"""Model factory for the transitive closure extension."""
if referencing_class is None:
referencing_class = model_class
if foreign_key is None:
for field_obj in model_class._meta.... | Model factory for the transitive closure extension. | Below is the the instruction that describes the task:
### Input:
Model factory for the transitive closure extension.
### Response:
def ClosureTable(model_class, foreign_key=None, referencing_class=None,
referencing_key=None):
"""Model factory for the transitive closure extension."""
if ref... |
def getMorphParameters(fromTGFN, toTGFN, tierName,
filterFunc=None, useBlanks=False):
'''
Get intervals for source and target audio files
Use this information to find out how much to stretch/shrink each source
interval.
The target values are based on the contents of ... | Get intervals for source and target audio files
Use this information to find out how much to stretch/shrink each source
interval.
The target values are based on the contents of toTGFN. | Below is the the instruction that describes the task:
### Input:
Get intervals for source and target audio files
Use this information to find out how much to stretch/shrink each source
interval.
The target values are based on the contents of toTGFN.
### Response:
def getMorphParameters(fromTG... |
def getallkeys(self, key, failobj=None):
"""Returns a list of the full key names (not the items)
for all the matching values for key. The list will
contain a single entry for unambiguous matches and
multiple entries for ambiguous matches."""
if self.mmkeys is None: self._mmInit(... | Returns a list of the full key names (not the items)
for all the matching values for key. The list will
contain a single entry for unambiguous matches and
multiple entries for ambiguous matches. | Below is the the instruction that describes the task:
### Input:
Returns a list of the full key names (not the items)
for all the matching values for key. The list will
contain a single entry for unambiguous matches and
multiple entries for ambiguous matches.
### Response:
def getallkeys(s... |
def submit_audit(self, item_list):
"""
将第三方提交的代码包提交审核
详情请参考
https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&id=open1489140610_Uavc4
:param item_list: 提交审核项的一个列表(至少填写1项,至多填写5项)
:type item_list: list[dict]
:return: 审核编号
:rtype: int
"... | 将第三方提交的代码包提交审核
详情请参考
https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&id=open1489140610_Uavc4
:param item_list: 提交审核项的一个列表(至少填写1项,至多填写5项)
:type item_list: list[dict]
:return: 审核编号
:rtype: int | Below is the the instruction that describes the task:
### Input:
将第三方提交的代码包提交审核
详情请参考
https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&id=open1489140610_Uavc4
:param item_list: 提交审核项的一个列表(至少填写1项,至多填写5项)
:type item_list: list[dict]
:return: 审核编号
:rtype:... |
def hydrate_sources(sources_field, glob_match_error_behavior):
"""Given a SourcesField, request a Snapshot for its path_globs and create an EagerFilesetWithSpec.
"""
# TODO(#5864): merge the target's selection of --glob-expansion-failure (which doesn't exist yet)
# with the global default!
path_globs = source... | Given a SourcesField, request a Snapshot for its path_globs and create an EagerFilesetWithSpec. | Below is the the instruction that describes the task:
### Input:
Given a SourcesField, request a Snapshot for its path_globs and create an EagerFilesetWithSpec.
### Response:
def hydrate_sources(sources_field, glob_match_error_behavior):
"""Given a SourcesField, request a Snapshot for its path_globs and create a... |
def list(self, prefix='', delimiter='', filter_function=None, max_results=1, reverse_search=True, previous_key=''):
'''
a method to list keys in the collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value which results must no... | a method to list keys in the collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value which results must not contain (after prefix)
:param filter_function: (positional arguments) function used to filter results
:param max_results: int... | Below is the the instruction that describes the task:
### Input:
a method to list keys in the collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value which results must not contain (after prefix)
:param filter_function: (positional argume... |
def vertical_padding(self, padding=None):
"""Returns or sets (if a value is provided) the chart's vertical
padding. This determines how much space will be above and below the
display area, as a proportion of overall height, and should be a value
between 0 and 0.5
:param float pa... | Returns or sets (if a value is provided) the chart's vertical
padding. This determines how much space will be above and below the
display area, as a proportion of overall height, and should be a value
between 0 and 0.5
:param float padding: If given, the chart's vertical_padding\
... | Below is the the instruction that describes the task:
### Input:
Returns or sets (if a value is provided) the chart's vertical
padding. This determines how much space will be above and below the
display area, as a proportion of overall height, and should be a value
between 0 and 0.5
... |
def add_result(self, code, message=None):
"""
add a result to the internal result list
arguments:
same arguments as for Result()
"""
self._results.append(Result(code, message)) | add a result to the internal result list
arguments:
same arguments as for Result() | Below is the the instruction that describes the task:
### Input:
add a result to the internal result list
arguments:
same arguments as for Result()
### Response:
def add_result(self, code, message=None):
"""
add a result to the internal result list
arguments:
... |
def _compute_distance(self, rup, dists, C):
"""
Compute the distance function, equation (9):
"""
mref = 3.6
rref = 1.0
rval = np.sqrt(dists.rhypo ** 2 + C['h'] ** 2)
return (C['c1'] + C['c2'] * (rup.mag - mref)) *\
np.log10(rval / rref) + C['c3'] * (rv... | Compute the distance function, equation (9): | Below is the the instruction that describes the task:
### Input:
Compute the distance function, equation (9):
### Response:
def _compute_distance(self, rup, dists, C):
"""
Compute the distance function, equation (9):
"""
mref = 3.6
rref = 1.0
rval = np.sqrt(dists.rhy... |
def process_update(self, update):
"""Process an incoming update from a remote NetworkTables"""
data = json.loads(update)
NetworkTables.getEntry(data["k"]).setValue(data["v"]) | Process an incoming update from a remote NetworkTables | Below is the the instruction that describes the task:
### Input:
Process an incoming update from a remote NetworkTables
### Response:
def process_update(self, update):
"""Process an incoming update from a remote NetworkTables"""
data = json.loads(update)
NetworkTables.getEntry(data["k"]).se... |
def _dash_f_e_to_dict(self, info_filename, tree_filename):
"""
Raxml provides an option to fit model params to a tree,
selected with -f e.
The output is different and needs a different parser.
"""
with open(info_filename) as fl:
models, likelihood, partition_p... | Raxml provides an option to fit model params to a tree,
selected with -f e.
The output is different and needs a different parser. | Below is the the instruction that describes the task:
### Input:
Raxml provides an option to fit model params to a tree,
selected with -f e.
The output is different and needs a different parser.
### Response:
def _dash_f_e_to_dict(self, info_filename, tree_filename):
"""
Raxml provi... |
def to_kraus(self):
"""
Compute the Kraus operator representation of the estimated process.
:return: The process as a list of Kraus operators.
:rytpe: List[np.array]
"""
return [k.data.toarray() for k in qt.to_kraus(self.sop)] | Compute the Kraus operator representation of the estimated process.
:return: The process as a list of Kraus operators.
:rytpe: List[np.array] | Below is the the instruction that describes the task:
### Input:
Compute the Kraus operator representation of the estimated process.
:return: The process as a list of Kraus operators.
:rytpe: List[np.array]
### Response:
def to_kraus(self):
"""
Compute the Kraus operator representa... |
def create_discount_coupon(cls, discount_coupon, **kwargs):
"""Create DiscountCoupon
Create a new DiscountCoupon
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_discount_coupon(discount... | Create DiscountCoupon
Create a new DiscountCoupon
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_discount_coupon(discount_coupon, async=True)
>>> result = thread.get()
:param ... | Below is the the instruction that describes the task:
### Input:
Create DiscountCoupon
Create a new DiscountCoupon
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_discount_coupon(discount_c... |
def set_style(style=None, rc=None):
"""
Set the aesthetic style of the plots.
This affects things like the color of the axes, whether a grid is
enabled by default, and other aesthetic elements.
Parameters
----------
style : dict, None, or one of {darkgrid, whitegrid, dark, white, ticks}
... | Set the aesthetic style of the plots.
This affects things like the color of the axes, whether a grid is
enabled by default, and other aesthetic elements.
Parameters
----------
style : dict, None, or one of {darkgrid, whitegrid, dark, white, ticks}
A dictionary of parameters or the name of ... | Below is the the instruction that describes the task:
### Input:
Set the aesthetic style of the plots.
This affects things like the color of the axes, whether a grid is
enabled by default, and other aesthetic elements.
Parameters
----------
style : dict, None, or one of {darkgrid, whitegrid, d... |
def api_version(profile=None, **connection_args):
'''
Returns the API version derived from endpoint's response.
CLI Example:
.. code-block:: bash
salt '*' keystone.api_version
'''
kwargs = _get_kwargs(profile=profile, **connection_args)
auth_url = kwargs.get('auth_url', kwargs.get... | Returns the API version derived from endpoint's response.
CLI Example:
.. code-block:: bash
salt '*' keystone.api_version | Below is the the instruction that describes the task:
### Input:
Returns the API version derived from endpoint's response.
CLI Example:
.. code-block:: bash
salt '*' keystone.api_version
### Response:
def api_version(profile=None, **connection_args):
'''
Returns the API version derived f... |
def csview(self, view=False):
"""View chemical shift values organized by amino acid residue.
:param view: Open in default image viewer or save file in current working directory quietly.
:type view: :py:obj:`True` or :py:obj:`False`
:return: None
:rtype: :py:obj:`None`
""... | View chemical shift values organized by amino acid residue.
:param view: Open in default image viewer or save file in current working directory quietly.
:type view: :py:obj:`True` or :py:obj:`False`
:return: None
:rtype: :py:obj:`None` | Below is the the instruction that describes the task:
### Input:
View chemical shift values organized by amino acid residue.
:param view: Open in default image viewer or save file in current working directory quietly.
:type view: :py:obj:`True` or :py:obj:`False`
:return: None
:rtyp... |
def _get_file_from_s3(metadata, saltenv, bucket_name, path, cached_file_path):
'''
Checks the local cache for the file, if it's old or missing go grab the
file from S3 and update the cache
'''
key, keyid, service_url, verify_ssl, kms_keyid, location, path_style, https_enable = _get_s3_key()
# c... | Checks the local cache for the file, if it's old or missing go grab the
file from S3 and update the cache | Below is the the instruction that describes the task:
### Input:
Checks the local cache for the file, if it's old or missing go grab the
file from S3 and update the cache
### Response:
def _get_file_from_s3(metadata, saltenv, bucket_name, path, cached_file_path):
'''
Checks the local cache for the file... |
def get_preinit_encoders(encoders: List[encoder.Encoder]) -> List[Tuple[str, mx.init.Initializer]]:
"""
Get initializers from encoders. Some encoders might be initialized from pretrained models.
:param encoders: List of encoders
:return: The list of initializers
"""
init = [] # type: List[Tupl... | Get initializers from encoders. Some encoders might be initialized from pretrained models.
:param encoders: List of encoders
:return: The list of initializers | Below is the the instruction that describes the task:
### Input:
Get initializers from encoders. Some encoders might be initialized from pretrained models.
:param encoders: List of encoders
:return: The list of initializers
### Response:
def get_preinit_encoders(encoders: List[encoder.Encoder]) -> List[Tu... |
def neighbors_iter(self, n, t=None):
"""Return an iterator over all neighbors of node n at time t.
Parameters
----------
n : node
A node in the graph
t : snapshot id (default=None)
If None will be returned an iterator over the neighbors of the node on the ... | Return an iterator over all neighbors of node n at time t.
Parameters
----------
n : node
A node in the graph
t : snapshot id (default=None)
If None will be returned an iterator over the neighbors of the node on the flattened graph.
Examples
-----... | Below is the the instruction that describes the task:
### Input:
Return an iterator over all neighbors of node n at time t.
Parameters
----------
n : node
A node in the graph
t : snapshot id (default=None)
If None will be returned an iterator over the neighbor... |
def get_project(self, project_id):
""" http://confluence.jetbrains.net/display/YTD2/GET+project
"""
return youtrack.Project(self._get("/admin/project/" + urlquote(project_id)), self) | http://confluence.jetbrains.net/display/YTD2/GET+project | Below is the the instruction that describes the task:
### Input:
http://confluence.jetbrains.net/display/YTD2/GET+project
### Response:
def get_project(self, project_id):
""" http://confluence.jetbrains.net/display/YTD2/GET+project
"""
return youtrack.Project(self._get("/admin/project/" + u... |
def handle_connection_exec(client):
"""
Alternate connection handler. No output redirection.
"""
class ExitExecLoop(Exception):
pass
def exit():
raise ExitExecLoop()
client.settimeout(None)
fh = os.fdopen(client.detach() if hasattr(client, 'detach') else client.fileno())
... | Alternate connection handler. No output redirection. | Below is the the instruction that describes the task:
### Input:
Alternate connection handler. No output redirection.
### Response:
def handle_connection_exec(client):
"""
Alternate connection handler. No output redirection.
"""
class ExitExecLoop(Exception):
pass
def exit():
r... |
def _register_notification_callback(self, connection_handle, attribute_handle, callback, once=False):
"""Register a callback as a notification callback. It will be called if a notification with the matching
connection_handle and attribute_handle is received.
Args:
connection_handle ... | Register a callback as a notification callback. It will be called if a notification with the matching
connection_handle and attribute_handle is received.
Args:
connection_handle (int): The connection handle to watch
attribute_handle (int): The attribute handle to watch
... | Below is the the instruction that describes the task:
### Input:
Register a callback as a notification callback. It will be called if a notification with the matching
connection_handle and attribute_handle is received.
Args:
connection_handle (int): The connection handle to watch
... |
def analyze(self, count):
""" Analyze count data from :meth:`PDFHistogram.count`.
Turns an array of counts (see :meth:`PDFHistogram.count`) into a
histogram of probabilities, and estimates the mean, standard
deviation, and other statistical characteristics of the corresponding
... | Analyze count data from :meth:`PDFHistogram.count`.
Turns an array of counts (see :meth:`PDFHistogram.count`) into a
histogram of probabilities, and estimates the mean, standard
deviation, and other statistical characteristics of the corresponding
probability distribution.
Arg... | Below is the the instruction that describes the task:
### Input:
Analyze count data from :meth:`PDFHistogram.count`.
Turns an array of counts (see :meth:`PDFHistogram.count`) into a
histogram of probabilities, and estimates the mean, standard
deviation, and other statistical characteristic... |
def distribute_ready(self):
'''Distribute the ready state across all of the connections'''
connections = [c for c in self.connections() if c.alive()]
if len(connections) > self._max_in_flight:
raise NotImplementedError(
'Max in flight must be greater than number of co... | Distribute the ready state across all of the connections | Below is the the instruction that describes the task:
### Input:
Distribute the ready state across all of the connections
### Response:
def distribute_ready(self):
'''Distribute the ready state across all of the connections'''
connections = [c for c in self.connections() if c.alive()]
if le... |
def train(ctx, output, corpus, clusters):
"""Train POS Tagger."""
click.echo('chemdataextractor.pos.train')
click.echo('Output: %s' % output)
click.echo('Corpus: %s' % corpus)
click.echo('Clusters: %s' % clusters)
wsj_sents = []
genia_sents = []
if corpus == 'wsj' or corpus == 'wsj+gen... | Train POS Tagger. | Below is the the instruction that describes the task:
### Input:
Train POS Tagger.
### Response:
def train(ctx, output, corpus, clusters):
"""Train POS Tagger."""
click.echo('chemdataextractor.pos.train')
click.echo('Output: %s' % output)
click.echo('Corpus: %s' % corpus)
click.echo('Clusters: ... |
def rownumbers(self, table=None):
"""Return a list containing the row numbers of this table.
This method can be useful after a selection or a sort.
It returns the row numbers of the rows in this table with respect
to the given table. If no table is given, the original table is used.
... | Return a list containing the row numbers of this table.
This method can be useful after a selection or a sort.
It returns the row numbers of the rows in this table with respect
to the given table. If no table is given, the original table is used.
For example::
t = table('W53... | Below is the the instruction that describes the task:
### Input:
Return a list containing the row numbers of this table.
This method can be useful after a selection or a sort.
It returns the row numbers of the rows in this table with respect
to the given table. If no table is given, the ori... |
def arsc(input_,
file_,
output,
package,
locale,
type_,
id_,
list_packages,
list_locales,
list_types):
"""
Decode resources.arsc either directly from a given file or from an APK.
Example:
\b
$ androguard arsc app.... | Decode resources.arsc either directly from a given file or from an APK.
Example:
\b
$ androguard arsc app.apk | Below is the the instruction that describes the task:
### Input:
Decode resources.arsc either directly from a given file or from an APK.
Example:
\b
$ androguard arsc app.apk
### Response:
def arsc(input_,
file_,
output,
package,
locale,
type_,
... |
def to(self, new_unit):
"""
Conversion to a new_unit. Right now, only supports 1 to 1 mapping of
units of each type.
Args:
new_unit: New unit type.
Returns:
A FloatWithUnit object in the new units.
Example usage:
>>> e = Energy(1.1, "eV"... | Conversion to a new_unit. Right now, only supports 1 to 1 mapping of
units of each type.
Args:
new_unit: New unit type.
Returns:
A FloatWithUnit object in the new units.
Example usage:
>>> e = Energy(1.1, "eV")
>>> e = Energy(1.1, "Ha")
... | Below is the the instruction that describes the task:
### Input:
Conversion to a new_unit. Right now, only supports 1 to 1 mapping of
units of each type.
Args:
new_unit: New unit type.
Returns:
A FloatWithUnit object in the new units.
Example usage:
... |
def make_order_string(cls, order_specification):
"""
Converts the given order specification to a CQL order expression.
"""
registry = get_current_registry()
visitor_cls = registry.getUtility(IOrderSpecificationVisitor,
name=EXPRESSION_KIN... | Converts the given order specification to a CQL order expression. | Below is the the instruction that describes the task:
### Input:
Converts the given order specification to a CQL order expression.
### Response:
def make_order_string(cls, order_specification):
"""
Converts the given order specification to a CQL order expression.
"""
registry = get_... |
def serialize(self, subject, *objects_or_combinators):
""" object_combinators may also be URIRefs or Literals """
ec_s = rdflib.BNode()
if self.operator is not None:
if subject is not None:
yield subject, self.predicate, ec_s
yield from oc(ec_s)
... | object_combinators may also be URIRefs or Literals | Below is the the instruction that describes the task:
### Input:
object_combinators may also be URIRefs or Literals
### Response:
def serialize(self, subject, *objects_or_combinators):
""" object_combinators may also be URIRefs or Literals """
ec_s = rdflib.BNode()
if self.operator is not N... |
def postinit(
self,
args,
body,
decorators=None,
returns=None,
type_comment_returns=None,
type_comment_args=None,
):
"""Do some setup after initialisation.
:param args: The arguments that the function takes.
:type args: Arguments or li... | Do some setup after initialisation.
:param args: The arguments that the function takes.
:type args: Arguments or list
:param body: The contents of the function body.
:type body: list(NodeNG)
:param decorators: The decorators that are applied to this
method or funct... | Below is the the instruction that describes the task:
### Input:
Do some setup after initialisation.
:param args: The arguments that the function takes.
:type args: Arguments or list
:param body: The contents of the function body.
:type body: list(NodeNG)
:param decorators... |
def add_subscription(self, channel, callback_function):
"""
Add a channel to subscribe to and a callback function to
run when the channel receives an update.
If channel already exists, create a new "subscription"
and append another callback function.
Args:
ch... | Add a channel to subscribe to and a callback function to
run when the channel receives an update.
If channel already exists, create a new "subscription"
and append another callback function.
Args:
channel (str): The channel to add a subscription too.
callback_fun... | Below is the the instruction that describes the task:
### Input:
Add a channel to subscribe to and a callback function to
run when the channel receives an update.
If channel already exists, create a new "subscription"
and append another callback function.
Args:
channel (... |
def extend(self, key, array, **attrs):
"""
Extend the dataset associated to the given key; create it if needed
:param key: name of the dataset
:param array: array to store
:param attrs: a dictionary of attributes
"""
try:
dset = self.hdf5[key]
... | Extend the dataset associated to the given key; create it if needed
:param key: name of the dataset
:param array: array to store
:param attrs: a dictionary of attributes | Below is the the instruction that describes the task:
### Input:
Extend the dataset associated to the given key; create it if needed
:param key: name of the dataset
:param array: array to store
:param attrs: a dictionary of attributes
### Response:
def extend(self, key, array, **attrs):
... |
def confirm_destructive_query(queries):
"""Check if the query is destructive and prompts the user to confirm.
Returns:
* None if the query is non-destructive or we can't prompt the user.
* True if the query is destructive and the user wants to proceed.
* False if the query is destructive and the use... | Check if the query is destructive and prompts the user to confirm.
Returns:
* None if the query is non-destructive or we can't prompt the user.
* True if the query is destructive and the user wants to proceed.
* False if the query is destructive and the user doesn't want to proceed. | Below is the the instruction that describes the task:
### Input:
Check if the query is destructive and prompts the user to confirm.
Returns:
* None if the query is non-destructive or we can't prompt the user.
* True if the query is destructive and the user wants to proceed.
* False if the query is d... |
def getInfo(self, CorpNum, MgtKeyType, MgtKey):
""" 상태정보 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
return
처리결과. consist of code and message
raise
... | 상태정보 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
return
처리결과. consist of code and message
raise
PopbillException | Below is the the instruction that describes the task:
### Input:
상태정보 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
return
처리결과. consist of code and message
raise
... |
def randindex(lo, hi, n = 1.):
"""
Yields integers in the range [lo, hi) where 0 <= lo < hi. Each
return value is a two-element tuple. The first element is the
random integer, the second is the natural logarithm of the
probability with which that integer will be chosen.
The CDF for the distribution from which ... | Yields integers in the range [lo, hi) where 0 <= lo < hi. Each
return value is a two-element tuple. The first element is the
random integer, the second is the natural logarithm of the
probability with which that integer will be chosen.
The CDF for the distribution from which the integers are drawn goes
as [inte... | Below is the the instruction that describes the task:
### Input:
Yields integers in the range [lo, hi) where 0 <= lo < hi. Each
return value is a two-element tuple. The first element is the
random integer, the second is the natural logarithm of the
probability with which that integer will be chosen.
The CDF ... |
def publish_message_to_centrifugo(sender, instance, created, **kwargs):
""" Publishes each saved message to Centrifugo. """
if created is True:
client = Client("{0}api/".format(getattr(settings, "CENTRIFUGE_ADDRESS")), getattr(settings, "CENTRIFUGE_SECRET"))
# we ensure the client is still in th... | Publishes each saved message to Centrifugo. | Below is the the instruction that describes the task:
### Input:
Publishes each saved message to Centrifugo.
### Response:
def publish_message_to_centrifugo(sender, instance, created, **kwargs):
""" Publishes each saved message to Centrifugo. """
if created is True:
client = Client("{0}api/".format... |
def checkout(url, version=None):
"""
Checks out latest version of item or repository.
:param url: URL of repo or item to check out.
:param version: Version number to check out.
"""
from grit import Repo
r = Repo(url)
def _write(item):
log.debug('writing: %s' % item.name)
... | Checks out latest version of item or repository.
:param url: URL of repo or item to check out.
:param version: Version number to check out. | Below is the the instruction that describes the task:
### Input:
Checks out latest version of item or repository.
:param url: URL of repo or item to check out.
:param version: Version number to check out.
### Response:
def checkout(url, version=None):
"""
Checks out latest version of item or repos... |
def _GetStringValue(self, data_dict, name, default_value=None):
"""Retrieves a specific string value from the data dict.
Args:
data_dict (dict[str, list[str]): values per name.
name (str): name of the value to retrieve.
default_value (Optional[object]): value to return if the name has no valu... | Retrieves a specific string value from the data dict.
Args:
data_dict (dict[str, list[str]): values per name.
name (str): name of the value to retrieve.
default_value (Optional[object]): value to return if the name has no value
set in data_dict.
Returns:
str: value represente... | Below is the the instruction that describes the task:
### Input:
Retrieves a specific string value from the data dict.
Args:
data_dict (dict[str, list[str]): values per name.
name (str): name of the value to retrieve.
default_value (Optional[object]): value to return if the name has no value
... |
def like_num(text):
"""
check if text resembles a number
"""
text = (
text.replace(",", "")
.replace(".", "")
.replace("،", "")
.replace("٫", "")
.replace("/", "")
)
if text.isdigit():
return True
if text in _num_words:
return True
... | check if text resembles a number | Below is the the instruction that describes the task:
### Input:
check if text resembles a number
### Response:
def like_num(text):
"""
check if text resembles a number
"""
text = (
text.replace(",", "")
.replace(".", "")
.replace("،", "")
.replace("٫", "")
.... |
def datasource_process(self, datasource_id):
"""
deprecated
Запускает настроенные обработки в фиде
:param datasource_id: uuid
"""
# TODO Выпилить потом класс используется для другого
# TODO без applicationId не выбираются поля сущностей. Подумать на сколько это НЕ... | deprecated
Запускает настроенные обработки в фиде
:param datasource_id: uuid | Below is the the instruction that describes the task:
### Input:
deprecated
Запускает настроенные обработки в фиде
:param datasource_id: uuid
### Response:
def datasource_process(self, datasource_id):
"""
deprecated
Запускает настроенные обработки в фиде
:param datas... |
def version(verbose):
"""Prints the current version number"""
print(Fore.BLUE + '-=' * 15)
print(Fore.YELLOW + 'Superset ' + Fore.CYAN + '{version}'.format(
version=config.get('VERSION_STRING')))
print(Fore.BLUE + '-=' * 15)
if verbose:
print('[DB] : ' + '{}'.format(db.engine))
p... | Prints the current version number | Below is the the instruction that describes the task:
### Input:
Prints the current version number
### Response:
def version(verbose):
"""Prints the current version number"""
print(Fore.BLUE + '-=' * 15)
print(Fore.YELLOW + 'Superset ' + Fore.CYAN + '{version}'.format(
version=config.get('VERSI... |
def usage_example(phrase, format='json'):
"""Takes the source phrase and queries it to the urbandictionary API
:params phrase: word for which usage_example is to be found
:param format: response structure type. Defaults to: "json"
:returns: returns a json object as str, False if invalid... | Takes the source phrase and queries it to the urbandictionary API
:params phrase: word for which usage_example is to be found
:param format: response structure type. Defaults to: "json"
:returns: returns a json object as str, False if invalid phrase | Below is the the instruction that describes the task:
### Input:
Takes the source phrase and queries it to the urbandictionary API
:params phrase: word for which usage_example is to be found
:param format: response structure type. Defaults to: "json"
:returns: returns a json object as str, ... |
def forecast(self, throughputs, backlog_size, num_simulations=10000, max_periods=10000, seed=None):
"""Forecasts how long a backlog will take to complete given the historical values provided.
Arguments:
throughputs(List[int]): Number of units completed per unit of time (stories per week, sto... | Forecasts how long a backlog will take to complete given the historical values provided.
Arguments:
throughputs(List[int]): Number of units completed per unit of time (stories per week, story points per month, etc.)
backlog_size(int): Units in the backlog (stories, points, etc.)
... | Below is the the instruction that describes the task:
### Input:
Forecasts how long a backlog will take to complete given the historical values provided.
Arguments:
throughputs(List[int]): Number of units completed per unit of time (stories per week, story points per month, etc.)
bac... |
def fuzzy_match(self, proc):
"""
Are there any commands that contain the given text?
Returns:
boolean: ``True`` if the word ``proc`` appears in the command column.
.. note::
'proc' can match anywhere in the command path, name or arguments.
"""
ret... | Are there any commands that contain the given text?
Returns:
boolean: ``True`` if the word ``proc`` appears in the command column.
.. note::
'proc' can match anywhere in the command path, name or arguments. | Below is the the instruction that describes the task:
### Input:
Are there any commands that contain the given text?
Returns:
boolean: ``True`` if the word ``proc`` appears in the command column.
.. note::
'proc' can match anywhere in the command path, name or arguments.
###... |
def add_direction(value, arg=u"rtl_only"):
"""Adds direction to the element
:arguments:
arg
* rtl_only: Add the direction only in case of a
right-to-left language (default)
* both: add the direction in both case
* ltr_only: Add the direction only in cas... | Adds direction to the element
:arguments:
arg
* rtl_only: Add the direction only in case of a
right-to-left language (default)
* both: add the direction in both case
* ltr_only: Add the direction only in case of a
left-to-right language
{... | Below is the the instruction that describes the task:
### Input:
Adds direction to the element
:arguments:
arg
* rtl_only: Add the direction only in case of a
right-to-left language (default)
* both: add the direction in both case
* ltr_only: Add the di... |
def main():
"""Writes out newsfile if significant version bump"""
last_known = '0'
if os.path.isfile(metafile):
with open(metafile) as fh:
last_known = fh.read()
import mbed_cloud
current = mbed_cloud.__version__
# how significant a change in version scheme should trigger a... | Writes out newsfile if significant version bump | Below is the the instruction that describes the task:
### Input:
Writes out newsfile if significant version bump
### Response:
def main():
"""Writes out newsfile if significant version bump"""
last_known = '0'
if os.path.isfile(metafile):
with open(metafile) as fh:
last_known = fh.r... |
def find_by_id(self, submission_id):
"""Finds submission by ID.
Args:
submission_id: ID of the submission
Returns:
SubmissionDescriptor with information about submission or None if
submission is not found.
"""
return self._attacks.get(
submission_id,
self._defense... | Finds submission by ID.
Args:
submission_id: ID of the submission
Returns:
SubmissionDescriptor with information about submission or None if
submission is not found. | Below is the the instruction that describes the task:
### Input:
Finds submission by ID.
Args:
submission_id: ID of the submission
Returns:
SubmissionDescriptor with information about submission or None if
submission is not found.
### Response:
def find_by_id(self, submission_id):
"... |
def set_value(self, value):
"""
Sets the user value (mode) of the choice. Like for Symbol.set_value(),
the visibility might truncate the value. Choices without the 'optional'
attribute (is_optional) can never be in n mode, but 0/"n" is still
accepted since it's not a malformed va... | Sets the user value (mode) of the choice. Like for Symbol.set_value(),
the visibility might truncate the value. Choices without the 'optional'
attribute (is_optional) can never be in n mode, but 0/"n" is still
accepted since it's not a malformed value (though it will have no
effect).
... | Below is the the instruction that describes the task:
### Input:
Sets the user value (mode) of the choice. Like for Symbol.set_value(),
the visibility might truncate the value. Choices without the 'optional'
attribute (is_optional) can never be in n mode, but 0/"n" is still
accepted since it... |
def makeService(cls, options):
"""
Create an L{IService} for the database specified by the given
configuration.
"""
from axiom.store import Store
jm = options['journal-mode']
if jm is not None:
jm = jm.decode('ascii')
store = Store(options['dbd... | Create an L{IService} for the database specified by the given
configuration. | Below is the the instruction that describes the task:
### Input:
Create an L{IService} for the database specified by the given
configuration.
### Response:
def makeService(cls, options):
"""
Create an L{IService} for the database specified by the given
configuration.
"""
... |
def text2text_generate_encoded(sample_generator,
vocab,
targets_vocab=None,
has_inputs=True,
inputs_prefix="",
targets_prefix=""):
"""Encode Text2Text samples from... | Encode Text2Text samples from the generator with the vocab. | Below is the the instruction that describes the task:
### Input:
Encode Text2Text samples from the generator with the vocab.
### Response:
def text2text_generate_encoded(sample_generator,
vocab,
targets_vocab=None,
has_inp... |
def get_list(self, section, option):
"""
This allows for loading of Pyramid list style configuration
options:
[foo]
bar =
baz
qux
zap
``get_list('foo', 'bar')`` returns ``['baz', 'qux', 'zap']``
:param str section:
... | This allows for loading of Pyramid list style configuration
options:
[foo]
bar =
baz
qux
zap
``get_list('foo', 'bar')`` returns ``['baz', 'qux', 'zap']``
:param str section:
The section to read.
:param str option:
... | Below is the the instruction that describes the task:
### Input:
This allows for loading of Pyramid list style configuration
options:
[foo]
bar =
baz
qux
zap
``get_list('foo', 'bar')`` returns ``['baz', 'qux', 'zap']``
:param str section... |
def n_subfile(self):
"""
Count how many files in this directory (doesn't include files in
sub folders).
"""
self.assert_is_dir_and_exists()
n = 0
for _ in self.select_file(recursive=False):
n += 1
return n | Count how many files in this directory (doesn't include files in
sub folders). | Below is the the instruction that describes the task:
### Input:
Count how many files in this directory (doesn't include files in
sub folders).
### Response:
def n_subfile(self):
"""
Count how many files in this directory (doesn't include files in
sub folders).
"""
s... |
def write_percolator_xml(staticxml, feats, fn):
"""Given the static percolator xml root and process info nodes, and all
psms and peptides as iterators in a dict {'peptide': pep_iterator, 'psm':
psm_iterator}, this generates percolator out data into a file."""
# First get xml until psms opening element ... | Given the static percolator xml root and process info nodes, and all
psms and peptides as iterators in a dict {'peptide': pep_iterator, 'psm':
psm_iterator}, this generates percolator out data into a file. | Below is the the instruction that describes the task:
### Input:
Given the static percolator xml root and process info nodes, and all
psms and peptides as iterators in a dict {'peptide': pep_iterator, 'psm':
psm_iterator}, this generates percolator out data into a file.
### Response:
def write_percolator_x... |
def get_batch(self, user_list):
"""
批量获取用户基本信息
开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_list: user_list,支持“使用示例”中两种输入格式
:return: 用户信息的 list
使用示例::
from wechatpy i... | 批量获取用户基本信息
开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_list: user_list,支持“使用示例”中两种输入格式
:return: 用户信息的 list
使用示例::
from wechatpy import WeChatClient
client = WeChatClien... | Below is the the instruction that describes the task:
### Input:
批量获取用户基本信息
开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_list: user_list,支持“使用示例”中两种输入格式
:return: 用户信息的 list
使用示例::
... |
def add_pk_if_required(db, table, name):
"""Return a class deriving from our Model class as well as the SQLAlchemy
model.
:param `sqlalchemy.schema.Table` table: table to create primary key for
:param table: table to create primary key for
"""
db.metadata.reflect(bind=db.engine)
cls_dict ... | Return a class deriving from our Model class as well as the SQLAlchemy
model.
:param `sqlalchemy.schema.Table` table: table to create primary key for
:param table: table to create primary key for | Below is the the instruction that describes the task:
### Input:
Return a class deriving from our Model class as well as the SQLAlchemy
model.
:param `sqlalchemy.schema.Table` table: table to create primary key for
:param table: table to create primary key for
### Response:
def add_pk_if_required(db,... |
def _reregister_types(self):
"""Registers existing types for a new connection"""
for _type in self._register_types:
psycopg2.extensions.register_type(psycopg2.extensions.new_type(*_type)) | Registers existing types for a new connection | Below is the the instruction that describes the task:
### Input:
Registers existing types for a new connection
### Response:
def _reregister_types(self):
"""Registers existing types for a new connection"""
for _type in self._register_types:
psycopg2.extensions.register_type(psycopg2.ext... |
def reduce_lists(d):
"""Replace single item lists in a dictionary with the single item."""
for field in d:
old_data = d[field]
if len(old_data) == 1:
d[field] = old_data[0] | Replace single item lists in a dictionary with the single item. | Below is the the instruction that describes the task:
### Input:
Replace single item lists in a dictionary with the single item.
### Response:
def reduce_lists(d):
"""Replace single item lists in a dictionary with the single item."""
for field in d:
old_data = d[field]
if len(old_data) == 1... |
def batch_face_locations(images, number_of_times_to_upsample=1, batch_size=128):
"""
Returns an 2d array of bounding boxes of human faces in a image using the cnn face detector
If you are using a GPU, this can give you much faster results since the GPU
can process batches of images at once. If you aren'... | Returns an 2d array of bounding boxes of human faces in a image using the cnn face detector
If you are using a GPU, this can give you much faster results since the GPU
can process batches of images at once. If you aren't using a GPU, you don't need this function.
:param img: A list of images (each as a num... | Below is the the instruction that describes the task:
### Input:
Returns an 2d array of bounding boxes of human faces in a image using the cnn face detector
If you are using a GPU, this can give you much faster results since the GPU
can process batches of images at once. If you aren't using a GPU, you don't... |
def configure_attributes(self, json_data):
"""Configure load balancer attributes such as idle timeout, connection draining, etc
Args:
json_data (json): return data from ELB upsert
"""
env = boto3.session.Session(profile_name=self.env, region_name=self.region)
elbclie... | Configure load balancer attributes such as idle timeout, connection draining, etc
Args:
json_data (json): return data from ELB upsert | Below is the the instruction that describes the task:
### Input:
Configure load balancer attributes such as idle timeout, connection draining, etc
Args:
json_data (json): return data from ELB upsert
### Response:
def configure_attributes(self, json_data):
"""Configure load balancer att... |
def extract_file_config(content):
"""
Pull out the file-specific config specified in the docstring.
"""
prop_pat = re.compile(
r"^\s*#\s*sphinx_gallery_([A-Za-z0-9_]+)\s*=\s*(.+)\s*$",
re.MULTILINE)
file_conf = {}
for match in re.finditer(prop_pat, content):
name = match... | Pull out the file-specific config specified in the docstring. | Below is the the instruction that describes the task:
### Input:
Pull out the file-specific config specified in the docstring.
### Response:
def extract_file_config(content):
"""
Pull out the file-specific config specified in the docstring.
"""
prop_pat = re.compile(
r"^\s*#\s*sphinx_galle... |
def check(jail=None,
chroot=None,
root=None,
depends=False,
recompute=False,
checksum=False):
'''
Sanity checks installed packages
jail
Perform the sanity check in the specified jail
CLI Example:
.. code-block:: bash
s... | Sanity checks installed packages
jail
Perform the sanity check in the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.check jail=<jail name or id>
chroot
Perform the sanity check in the specified chroot (ignored if ``jail``
is specified)
... | Below is the the instruction that describes the task:
### Input:
Sanity checks installed packages
jail
Perform the sanity check in the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.check jail=<jail name or id>
chroot
Perform the sanity check i... |
def locked_put(self, credentials):
"""Write a credentials to the SQLAlchemy datastore.
Args:
credentials: :class:`oauth2client.Credentials`
"""
filters = {self.key_name: self.key_value}
query = self.session.query(self.model_class).filter_by(**filters)
entity ... | Write a credentials to the SQLAlchemy datastore.
Args:
credentials: :class:`oauth2client.Credentials` | Below is the the instruction that describes the task:
### Input:
Write a credentials to the SQLAlchemy datastore.
Args:
credentials: :class:`oauth2client.Credentials`
### Response:
def locked_put(self, credentials):
"""Write a credentials to the SQLAlchemy datastore.
Args:
... |
def reverse(
self,
query,
exactly_one=DEFAULT_SENTINEL,
timeout=DEFAULT_SENTINEL,
feature_code=None,
lang=None,
find_nearby_type='findNearbyPlaceName',
):
"""
Return an address by location point.
.. vers... | Return an address by location point.
.. versionadded:: 1.2.0
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latit... | Below is the the instruction that describes the task:
### Input:
Return an address by location point.
.. versionadded:: 1.2.0
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tu... |
def check_auth(self):
"""Check authentication/authorization of client"""
# access permissions
if self.auth is not None:
return self.auth(self.request)
return self.public_readble, self.public_writable | Check authentication/authorization of client | Below is the the instruction that describes the task:
### Input:
Check authentication/authorization of client
### Response:
def check_auth(self):
"""Check authentication/authorization of client"""
# access permissions
if self.auth is not None:
return self.auth(self.request)
... |
def displayText(self, value, blank='', joiner=', '):
"""
Returns the display text for the value associated with
the inputted text. This will result in a comma separated
list of labels for the value, or the blank text provided if
no text is found.
:param val... | Returns the display text for the value associated with
the inputted text. This will result in a comma separated
list of labels for the value, or the blank text provided if
no text is found.
:param value | <variant>
blank | <str>
jo... | Below is the the instruction that describes the task:
### Input:
Returns the display text for the value associated with
the inputted text. This will result in a comma separated
list of labels for the value, or the blank text provided if
no text is found.
:param value ... |
def _generate_html(data, out):
'''
Generate report data as HTML
'''
print('<html>', file=out)
print('<body>', file=out)
_generate_html_table(data, out, 0)
print('</body>', file=out)
print('</html>', file=out) | Generate report data as HTML | Below is the the instruction that describes the task:
### Input:
Generate report data as HTML
### Response:
def _generate_html(data, out):
'''
Generate report data as HTML
'''
print('<html>', file=out)
print('<body>', file=out)
_generate_html_table(data, out, 0)
print('</body>', file=ou... |
def device_add_rule(self, direction, action, src, dst, target=None):
"""Adds a tuntap device rule.
To be used in a vassal.
:param str|unicode direction: Direction:
* in
* out.
:param str|unicode action: Action:
* allow
* deny
... | Adds a tuntap device rule.
To be used in a vassal.
:param str|unicode direction: Direction:
* in
* out.
:param str|unicode action: Action:
* allow
* deny
* route
* gateway.
:param str|unicode src: Source/mask.
... | Below is the the instruction that describes the task:
### Input:
Adds a tuntap device rule.
To be used in a vassal.
:param str|unicode direction: Direction:
* in
* out.
:param str|unicode action: Action:
* allow
* deny
* route
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.