code stringlengths 75 104k | docstring stringlengths 1 46.9k | text stringlengths 164 112k |
|---|---|---|
def clear_range(self, share_name, directory_name, file_name, start_range,
end_range, timeout=None):
'''
Clears the specified range and releases the space used in storage for
that range.
:param str share_name:
Name of existing share.
:par... | Clears the specified range and releases the space used in storage for
that range.
:param str share_name:
Name of existing share.
:param str directory_name:
The path to the directory.
:param str file_name:
Name of existing file.
:para... | Below is the the instruction that describes the task:
### Input:
Clears the specified range and releases the space used in storage for
that range.
:param str share_name:
Name of existing share.
:param str directory_name:
The path to the directory.
:... |
def monitoring(line, cell=None):
"""Implements the monitoring cell magic for ipython notebooks.
Args:
line: the contents of the storage line.
Returns:
The results of executing the cell.
"""
parser = datalab.utils.commands.CommandParser(prog='monitoring', description=(
'Execute various Monitorin... | Implements the monitoring cell magic for ipython notebooks.
Args:
line: the contents of the storage line.
Returns:
The results of executing the cell. | Below is the the instruction that describes the task:
### Input:
Implements the monitoring cell magic for ipython notebooks.
Args:
line: the contents of the storage line.
Returns:
The results of executing the cell.
### Response:
def monitoring(line, cell=None):
"""Implements the monitoring cell magi... |
def style_to_ansi_code(style):
"""
:param style: A style name
:type style: string
:returns: A string containing one or more ansi escape codes that are
used to render the given style.
:type return: string
"""
ret = ''
for attr_name in _styles[style]:
# allow stuff th... | :param style: A style name
:type style: string
:returns: A string containing one or more ansi escape codes that are
used to render the given style.
:type return: string | Below is the the instruction that describes the task:
### Input:
:param style: A style name
:type style: string
:returns: A string containing one or more ansi escape codes that are
used to render the given style.
:type return: string
### Response:
def style_to_ansi_code(style):
"""
... |
def mag_field(RAW_IMU, SENSOR_OFFSETS=None, ofs=None):
'''calculate magnetic field strength from raw magnetometer'''
mag_x = RAW_IMU.xmag
mag_y = RAW_IMU.ymag
mag_z = RAW_IMU.zmag
if SENSOR_OFFSETS is not None and ofs is not None:
mag_x += ofs[0] - SENSOR_OFFSETS.mag_ofs_x
mag_y += o... | calculate magnetic field strength from raw magnetometer | Below is the the instruction that describes the task:
### Input:
calculate magnetic field strength from raw magnetometer
### Response:
def mag_field(RAW_IMU, SENSOR_OFFSETS=None, ofs=None):
'''calculate magnetic field strength from raw magnetometer'''
mag_x = RAW_IMU.xmag
mag_y = RAW_IMU.ymag
mag_z... |
def FromBinary(cls, record_data, record_count=1):
"""Create an UpdateRecord subclass from binary record data.
This should be called with a binary record blob (NOT including the
record type header) and it will decode it into a PersistGraphRecord.
Args:
record_data (bytearray... | Create an UpdateRecord subclass from binary record data.
This should be called with a binary record blob (NOT including the
record type header) and it will decode it into a PersistGraphRecord.
Args:
record_data (bytearray): The raw record data that we wish to parse
... | Below is the the instruction that describes the task:
### Input:
Create an UpdateRecord subclass from binary record data.
This should be called with a binary record blob (NOT including the
record type header) and it will decode it into a PersistGraphRecord.
Args:
record_data (b... |
def touch(name, atime=None, mtime=None):
'''
.. versionadded:: 0.9.5
Just like the ``touch`` command, create a file if it doesn't exist or
simply update the atime and mtime if it already does.
atime:
Access time in Unix epoch time. Set it to 0 to set atime of the
file with Unix dat... | .. versionadded:: 0.9.5
Just like the ``touch`` command, create a file if it doesn't exist or
simply update the atime and mtime if it already does.
atime:
Access time in Unix epoch time. Set it to 0 to set atime of the
file with Unix date of birth. If this parameter isn't set, atime
... | Below is the the instruction that describes the task:
### Input:
.. versionadded:: 0.9.5
Just like the ``touch`` command, create a file if it doesn't exist or
simply update the atime and mtime if it already does.
atime:
Access time in Unix epoch time. Set it to 0 to set atime of the
fi... |
def append_stream(self, streamid, stream, encoding=None):
"""append a file to search for similarities"""
if encoding is None:
readlines = stream.readlines
else:
readlines = decoding_stream(stream, encoding).readlines
try:
self.linesets.append(
... | append a file to search for similarities | Below is the the instruction that describes the task:
### Input:
append a file to search for similarities
### Response:
def append_stream(self, streamid, stream, encoding=None):
"""append a file to search for similarities"""
if encoding is None:
readlines = stream.readlines
else... |
def timeout(self, value):
'''
Specifies a timeout on the search query
'''
if not self.params:
self.params = dict(timeout=value)
return self
self.params['timeout'] = value
return self | Specifies a timeout on the search query | Below is the the instruction that describes the task:
### Input:
Specifies a timeout on the search query
### Response:
def timeout(self, value):
'''
Specifies a timeout on the search query
'''
if not self.params:
self.params = dict(timeout=value)
return self
... |
def parse_with_retrieved(self, retrieved):
"""
Parse output data folder, store results in database.
:param retrieved: a dictionary of retrieved nodes, where
the key is the link name
:returns: a tuple with two values ``(bool, node_list)``,
where:
* ``bool`... | Parse output data folder, store results in database.
:param retrieved: a dictionary of retrieved nodes, where
the key is the link name
:returns: a tuple with two values ``(bool, node_list)``,
where:
* ``bool``: variable to tell if the parsing succeeded
* ``node... | Below is the the instruction that describes the task:
### Input:
Parse output data folder, store results in database.
:param retrieved: a dictionary of retrieved nodes, where
the key is the link name
:returns: a tuple with two values ``(bool, node_list)``,
where:
* `... |
def get_missing_required_annotations(self) -> List[str]:
"""Return missing required annotations."""
return [
required_annotation
for required_annotation in self.required_annotations
if required_annotation not in self.annotations
] | Return missing required annotations. | Below is the the instruction that describes the task:
### Input:
Return missing required annotations.
### Response:
def get_missing_required_annotations(self) -> List[str]:
"""Return missing required annotations."""
return [
required_annotation
for required_annotation in sel... |
def addfeature(self, geometry, fields=None):
"""
add a feature to the vector object from a geometry
Parameters
----------
geometry: :osgeo:class:`ogr.Geometry`
the geometry to add as a feature
fields: dict or None
the field names and value... | add a feature to the vector object from a geometry
Parameters
----------
geometry: :osgeo:class:`ogr.Geometry`
the geometry to add as a feature
fields: dict or None
the field names and values to assign to the new feature
Returns
------- | Below is the the instruction that describes the task:
### Input:
add a feature to the vector object from a geometry
Parameters
----------
geometry: :osgeo:class:`ogr.Geometry`
the geometry to add as a feature
fields: dict or None
the field names and v... |
def results(self) -> List[TrialResult]:
"""Returns the job results, blocking until the job is complete."""
if not self._results:
job = self._update_job()
for _ in range(1000):
if job['executionStatus']['state'] in TERMINAL_STATES:
break
... | Returns the job results, blocking until the job is complete. | Below is the the instruction that describes the task:
### Input:
Returns the job results, blocking until the job is complete.
### Response:
def results(self) -> List[TrialResult]:
"""Returns the job results, blocking until the job is complete."""
if not self._results:
job = self._update... |
def compareValues(self, a, b):
"""
Compares two values based on their values for this axis.
:param a | <variant>
b | <variant>
"""
values = self.values()
try:
return cmp(values.index(a), values.index(b))
exce... | Compares two values based on their values for this axis.
:param a | <variant>
b | <variant> | Below is the the instruction that describes the task:
### Input:
Compares two values based on their values for this axis.
:param a | <variant>
b | <variant>
### Response:
def compareValues(self, a, b):
"""
Compares two values based on their values for ... |
def convert_camel_case_keys(original_dict: Dict[str, Any]) -> Dict[str, Any]:
"""Converts all keys of a dict from camel case to snake case, recursively"""
new_dict = dict()
for key, val in original_dict.items():
if isinstance(val, dict):
# Recurse
new_dict[convert_camel_case_... | Converts all keys of a dict from camel case to snake case, recursively | Below is the the instruction that describes the task:
### Input:
Converts all keys of a dict from camel case to snake case, recursively
### Response:
def convert_camel_case_keys(original_dict: Dict[str, Any]) -> Dict[str, Any]:
"""Converts all keys of a dict from camel case to snake case, recursively"""
ne... |
def Hi(self, str_, salt, i):
"""The Hi(str, salt, i) function."""
# pylint: disable=C0103
Uj = self.HMAC(str_, salt + b"\000\000\000\001") # U1
result = Uj
for _ in range(2, i + 1):
Uj = self.HMAC(str_, Uj) # Uj = HMAC(str, Uj-1)
result = sel... | The Hi(str, salt, i) function. | Below is the the instruction that describes the task:
### Input:
The Hi(str, salt, i) function.
### Response:
def Hi(self, str_, salt, i):
"""The Hi(str, salt, i) function."""
# pylint: disable=C0103
Uj = self.HMAC(str_, salt + b"\000\000\000\001") # U1
result = Uj
for _ in ... |
def _gzip(self, response):
"""Apply gzip compression to a response."""
bytesio = six.BytesIO()
with gzip.GzipFile(fileobj=bytesio, mode='w') as gz:
gz.write(response)
return bytesio.getvalue() | Apply gzip compression to a response. | Below is the the instruction that describes the task:
### Input:
Apply gzip compression to a response.
### Response:
def _gzip(self, response):
"""Apply gzip compression to a response."""
bytesio = six.BytesIO()
with gzip.GzipFile(fileobj=bytesio, mode='w') as gz:
gz.write(respo... |
def read_videos(self, begtime=None, endtime=None):
"""Return list of videos with start and end times for a period.
Parameters
----------
begtime : int or datedelta or datetime or list
start of the data to read;
if it's int, it's assumed it's s;
if it'... | Return list of videos with start and end times for a period.
Parameters
----------
begtime : int or datedelta or datetime or list
start of the data to read;
if it's int, it's assumed it's s;
if it's datedelta, it's assumed from the start of the recording;
... | Below is the the instruction that describes the task:
### Input:
Return list of videos with start and end times for a period.
Parameters
----------
begtime : int or datedelta or datetime or list
start of the data to read;
if it's int, it's assumed it's s;
... |
def print_raw_data(raw_data, start_index=0, limit=200, flavor='fei4b', index_offset=0, select=None, tdc_trig_dist=False, trigger_data_mode=0):
"""Printing FEI4 raw data array for debugging.
"""
if not select:
select = ['DH', 'TW', "AR", "VR", "SR", "DR", 'TDC', 'UNKNOWN FE WORD', 'UNKNOWN WORD']
... | Printing FEI4 raw data array for debugging. | Below is the the instruction that describes the task:
### Input:
Printing FEI4 raw data array for debugging.
### Response:
def print_raw_data(raw_data, start_index=0, limit=200, flavor='fei4b', index_offset=0, select=None, tdc_trig_dist=False, trigger_data_mode=0):
"""Printing FEI4 raw data array for debugging... |
def poll_queue(job_id, pid, poll_time):
"""
Check the queue of executing/submitted jobs and exit when there is
a free slot.
"""
if config.distribution.serialize_jobs:
first_time = True
while True:
jobs = logs.dbcmd(GET_JOBS)
failed = [job.id for job in jobs if... | Check the queue of executing/submitted jobs and exit when there is
a free slot. | Below is the the instruction that describes the task:
### Input:
Check the queue of executing/submitted jobs and exit when there is
a free slot.
### Response:
def poll_queue(job_id, pid, poll_time):
"""
Check the queue of executing/submitted jobs and exit when there is
a free slot.
"""
if c... |
def detect_mode(cls, **params):
"""Detect which listing mode of the given params.
:params kwargs params: the params
:return: one of the available modes
:rtype: str
:raises ValueError: if multiple modes are detected
"""
modes = []
for mode in cls.modes:
... | Detect which listing mode of the given params.
:params kwargs params: the params
:return: one of the available modes
:rtype: str
:raises ValueError: if multiple modes are detected | Below is the the instruction that describes the task:
### Input:
Detect which listing mode of the given params.
:params kwargs params: the params
:return: one of the available modes
:rtype: str
:raises ValueError: if multiple modes are detected
### Response:
def detect_mode(cls, **... |
def plotPotentials(Pot,rmin=0.,rmax=1.5,nrs=21,zmin=-0.5,zmax=0.5,nzs=21,
phi=None,xy=False,t=0.,effective=False,Lz=None,
ncontours=21,savefilename=None,aspect=None,
justcontours=False,levels=None,cntrcolors=None):
"""
NAME:
plotPotent... | NAME:
plotPotentials
PURPOSE:
plot a set of potentials
INPUT:
Pot - Potential or list of Potential instances
rmin= minimum R (can be Quantity) [xmin if xy]
rmax= maximum R (can be Quantity) [ymax if xy]
nrs= grid in R
... | Below is the the instruction that describes the task:
### Input:
NAME:
plotPotentials
PURPOSE:
plot a set of potentials
INPUT:
Pot - Potential or list of Potential instances
rmin= minimum R (can be Quantity) [xmin if xy]
rmax= maximum R (... |
def recv_line(self, max_size=None, timeout='default', ending=None):
"""
Recieve until the next newline , default "\\n". The newline string can
be changed by changing ``nc.LINE_ENDING``. The newline will be returned
as part of the string.
Aliases: recvline, readline, read_line, r... | Recieve until the next newline , default "\\n". The newline string can
be changed by changing ``nc.LINE_ENDING``. The newline will be returned
as part of the string.
Aliases: recvline, readline, read_line, readln, recvln | Below is the the instruction that describes the task:
### Input:
Recieve until the next newline , default "\\n". The newline string can
be changed by changing ``nc.LINE_ENDING``. The newline will be returned
as part of the string.
Aliases: recvline, readline, read_line, readln, recvln
### R... |
def protoc_command(lang, output_dir, proto_path, refactored_dir):
"""Runs the "protoc" command on the refactored Protobuf files to generate
the source python/python3 files.
Args:
lang (str): the language to compile with "protoc"
(i.e. python, python3)
output_dir (str): t... | Runs the "protoc" command on the refactored Protobuf files to generate
the source python/python3 files.
Args:
lang (str): the language to compile with "protoc"
(i.e. python, python3)
output_dir (str): the output directory for the generated source files
proto_path (st... | Below is the the instruction that describes the task:
### Input:
Runs the "protoc" command on the refactored Protobuf files to generate
the source python/python3 files.
Args:
lang (str): the language to compile with "protoc"
(i.e. python, python3)
output_dir (str): the o... |
def _warmest(self):
""" Group temperature as warm as possible. """
for _ in range(steps(self.temperature, 0.0,
self.command_set.temperature_steps)):
self._warmer() | Group temperature as warm as possible. | Below is the the instruction that describes the task:
### Input:
Group temperature as warm as possible.
### Response:
def _warmest(self):
""" Group temperature as warm as possible. """
for _ in range(steps(self.temperature, 0.0,
self.command_set.temperature_steps)):
... |
def _CompareFields(field, other_field):
"""Checks if two ProtoRPC fields are "equal".
Compares the arguments, rather than the id of the elements (which is
the default __eq__ behavior) as well as the class of the fields.
Args:
field: A ProtoRPC message field to be compared.
other_field: A ProtoRPC mess... | Checks if two ProtoRPC fields are "equal".
Compares the arguments, rather than the id of the elements (which is
the default __eq__ behavior) as well as the class of the fields.
Args:
field: A ProtoRPC message field to be compared.
other_field: A ProtoRPC message field to be compared.
Returns:
Boo... | Below is the the instruction that describes the task:
### Input:
Checks if two ProtoRPC fields are "equal".
Compares the arguments, rather than the id of the elements (which is
the default __eq__ behavior) as well as the class of the fields.
Args:
field: A ProtoRPC message field to be compared.
othe... |
def instruction_addresses(self):
"""
Get all instruction addresses in the binary.
:return: A list of sorted instruction addresses.
:rtype: list
"""
addrs = [ ]
for b in sorted(self.blocks, key=lambda x: x.addr): # type: BasicBlock
addrs.extend(b.ins... | Get all instruction addresses in the binary.
:return: A list of sorted instruction addresses.
:rtype: list | Below is the the instruction that describes the task:
### Input:
Get all instruction addresses in the binary.
:return: A list of sorted instruction addresses.
:rtype: list
### Response:
def instruction_addresses(self):
"""
Get all instruction addresses in the binary.
:retu... |
def removeOntology(self, ontology):
"""
Removes the specified ontology term map from this repository.
"""
q = models.Ontology.delete().where(id == ontology.getId())
q.execute() | Removes the specified ontology term map from this repository. | Below is the the instruction that describes the task:
### Input:
Removes the specified ontology term map from this repository.
### Response:
def removeOntology(self, ontology):
"""
Removes the specified ontology term map from this repository.
"""
q = models.Ontology.delete().where(i... |
def exact_or_minor_exe_version_match(executable_name,
exe_version_tuples,
version):
"""
IF there is an exact match then use it
OTHERWISE try to find a minor version match
"""
exe = exact_exe_version_match(executable_name,
... | IF there is an exact match then use it
OTHERWISE try to find a minor version match | Below is the the instruction that describes the task:
### Input:
IF there is an exact match then use it
OTHERWISE try to find a minor version match
### Response:
def exact_or_minor_exe_version_match(executable_name,
exe_version_tuples,
... |
def get_resource_from_handle(self, resource_handle):
"""Get a resource.
Args:
resource_handle (`ResourceHandle`): Handle of the resource.
Returns:
`PackageRepositoryResource` instance.
"""
repo_type = resource_handle.get("repository_type")
locati... | Get a resource.
Args:
resource_handle (`ResourceHandle`): Handle of the resource.
Returns:
`PackageRepositoryResource` instance. | Below is the the instruction that describes the task:
### Input:
Get a resource.
Args:
resource_handle (`ResourceHandle`): Handle of the resource.
Returns:
`PackageRepositoryResource` instance.
### Response:
def get_resource_from_handle(self, resource_handle):
"""G... |
def create_web_forward(self, zone_name, request_to, redirect_to, forward_type):
"""Create a web forward record.
Arguments:
zone_name -- The zone in which the web forward is to be created.
request_to -- The URL to be redirected. You may use http:// and ftp://.
forward_type -- The... | Create a web forward record.
Arguments:
zone_name -- The zone in which the web forward is to be created.
request_to -- The URL to be redirected. You may use http:// and ftp://.
forward_type -- The type of forward. Valid options include:
Framed
... | Below is the the instruction that describes the task:
### Input:
Create a web forward record.
Arguments:
zone_name -- The zone in which the web forward is to be created.
request_to -- The URL to be redirected. You may use http:// and ftp://.
forward_type -- The type of forward. Vali... |
def use_schema(schema, list_view=False, locations=None):
"""View decorator for using a marshmallow schema to
(1) parse a request's input and
(2) serializing the view's output to a JSON response.
"""
def decorator(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
... | View decorator for using a marshmallow schema to
(1) parse a request's input and
(2) serializing the view's output to a JSON response. | Below is the the instruction that describes the task:
### Input:
View decorator for using a marshmallow schema to
(1) parse a request's input and
(2) serializing the view's output to a JSON response.
### Response:
def use_schema(schema, list_view=False, locations=None):
"""View decorator for us... |
def from_notebook_node(self, nb, resources=None, **kw):
"""Create a Metatab package from a notebook node """
nb_copy = copy.deepcopy(nb)
# The the package name and directory, either from the inlined Metatab doc,
# or from the config
try:
self.output_dir = self.get_... | Create a Metatab package from a notebook node | Below is the the instruction that describes the task:
### Input:
Create a Metatab package from a notebook node
### Response:
def from_notebook_node(self, nb, resources=None, **kw):
"""Create a Metatab package from a notebook node """
nb_copy = copy.deepcopy(nb)
# The the package name and ... |
def pip_install(*args):
"""Send the given arguments to `pip install`.
"""
download_cache = ('--download-cache=%s ' % options.paved.pip.download_cache) if options.paved.pip.download_cache else ''
shv('pip install %s%s' % (download_cache, ' '.join(args))) | Send the given arguments to `pip install`. | Below is the the instruction that describes the task:
### Input:
Send the given arguments to `pip install`.
### Response:
def pip_install(*args):
"""Send the given arguments to `pip install`.
"""
download_cache = ('--download-cache=%s ' % options.paved.pip.download_cache) if options.paved.pip.download_... |
def extract_workflow(notebook):
'''Extract workflow from a notebook file or notebook JSON instance'''
if isinstance(notebook, str):
nb = nbformat.read(notebook, nbformat.NO_CONVERT)
else:
nb = notebook
cells = nb.cells
content = '#!/usr/bin/env sos-runner\n#fileformat=SOS1.0\n\n'
... | Extract workflow from a notebook file or notebook JSON instance | Below is the the instruction that describes the task:
### Input:
Extract workflow from a notebook file or notebook JSON instance
### Response:
def extract_workflow(notebook):
'''Extract workflow from a notebook file or notebook JSON instance'''
if isinstance(notebook, str):
nb = nbformat.read(noteb... |
def _create_summary_table(fn, template, nb_samples, nb_markers):
"""Creates the final table.
:param fn: the name of the file containing the summary.
:param template: the Jinja2 template.
:param nb_samples: the final number of samples.
:param nb_markers: the final number of markers.
:type fn: s... | Creates the final table.
:param fn: the name of the file containing the summary.
:param template: the Jinja2 template.
:param nb_samples: the final number of samples.
:param nb_markers: the final number of markers.
:type fn: str
:type template: Jinja2.template
:type nb_samples: str
:ty... | Below is the the instruction that describes the task:
### Input:
Creates the final table.
:param fn: the name of the file containing the summary.
:param template: the Jinja2 template.
:param nb_samples: the final number of samples.
:param nb_markers: the final number of markers.
:type fn: str
... |
def to_boolean(obj):
'''
Cast an arbitrary sequence to a boolean type
'''
#if hasattr(obj, '__iter__'):
if isinstance(obj, LiteralWrapper):
val = obj.obj
elif isinstance(obj, Iterable) and not isinstance(obj, str):
val = next(obj, None)
else:
val = obj
if val is N... | Cast an arbitrary sequence to a boolean type | Below is the the instruction that describes the task:
### Input:
Cast an arbitrary sequence to a boolean type
### Response:
def to_boolean(obj):
'''
Cast an arbitrary sequence to a boolean type
'''
#if hasattr(obj, '__iter__'):
if isinstance(obj, LiteralWrapper):
val = obj.obj
elif ... |
def fit(self, X, y, **kwargs):
"""Fit encoder according to X and y.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Training vectors, where n_samples is the number of samples
and n_features is the number of features.
y : array-like, ... | Fit encoder according to X and y.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Training vectors, where n_samples is the number of samples
and n_features is the number of features.
y : array-like, shape = [n_samples]
Target val... | Below is the the instruction that describes the task:
### Input:
Fit encoder according to X and y.
Parameters
----------
X : array-like, shape = [n_samples, n_features]
Training vectors, where n_samples is the number of samples
and n_features is the number of feature... |
def _build_page(self, filepath):
""" To build from filepath, relative to pages_dir """
filename = filepath.split("/")[-1]
# If filename starts with _ (underscore) or . (dot) do not build
if not filename.startswith(("_", ".")) and (filename.endswith(PAGE_FORMAT)):
meta = self.... | To build from filepath, relative to pages_dir | Below is the the instruction that describes the task:
### Input:
To build from filepath, relative to pages_dir
### Response:
def _build_page(self, filepath):
""" To build from filepath, relative to pages_dir """
filename = filepath.split("/")[-1]
# If filename starts with _ (underscore) or ... |
def fit_mcmc(self,nwalkers=300,nburn=200,niter=100,
p0=None,initial_burn=None,
ninitial=50, loglike_kwargs=None,
**kwargs):
"""Fits stellar model using MCMC.
:param nwalkers: (optional)
Number of walkers to pass to :class:`emcee.EnsembleSam... | Fits stellar model using MCMC.
:param nwalkers: (optional)
Number of walkers to pass to :class:`emcee.EnsembleSampler`.
Default is 200.
:param nburn: (optional)
Number of iterations for "burn-in." Default is 100.
:param niter: (optional)
Number... | Below is the the instruction that describes the task:
### Input:
Fits stellar model using MCMC.
:param nwalkers: (optional)
Number of walkers to pass to :class:`emcee.EnsembleSampler`.
Default is 200.
:param nburn: (optional)
Number of iterations for "burn-in." ... |
def getResultsInterpretationByDepartment(self, department=None):
"""Returns the results interpretation for this Analysis Request
and department. If department not set, returns the results
interpretation tagged as 'General'.
:returns: a dict with the following keys:
{'u... | Returns the results interpretation for this Analysis Request
and department. If department not set, returns the results
interpretation tagged as 'General'.
:returns: a dict with the following keys:
{'uid': <department_uid> or 'general', 'richtext': <text/plain>} | Below is the the instruction that describes the task:
### Input:
Returns the results interpretation for this Analysis Request
and department. If department not set, returns the results
interpretation tagged as 'General'.
:returns: a dict with the following keys:
{'uid': <d... |
def as_obj(func):
""" A decorator used to return a JSON response with a dict
representation of the model instance. It expects the decorated function
to return a Model instance. It then converts the instance to dicts
and serializes it into a json response
Examples:
>>> ... | A decorator used to return a JSON response with a dict
representation of the model instance. It expects the decorated function
to return a Model instance. It then converts the instance to dicts
and serializes it into a json response
Examples:
>>> @app.route('/api/shipments... | Below is the the instruction that describes the task:
### Input:
A decorator used to return a JSON response with a dict
representation of the model instance. It expects the decorated function
to return a Model instance. It then converts the instance to dicts
and serializes it into a json re... |
def internal_writer(self, outputs, stdout):
"""
Writer which outputs the python repr for each item.
"""
for output in outputs:
print("\t".join(map(self.internal_serialize, output)), file=stdout) | Writer which outputs the python repr for each item. | Below is the the instruction that describes the task:
### Input:
Writer which outputs the python repr for each item.
### Response:
def internal_writer(self, outputs, stdout):
"""
Writer which outputs the python repr for each item.
"""
for output in outputs:
print("\t".jo... |
def _construct_axes_dict_from(self, axes, **kwargs):
"""Return an axes dictionary for the passed axes."""
d = {a: ax for a, ax in zip(self._AXIS_ORDERS, axes)}
d.update(kwargs)
return d | Return an axes dictionary for the passed axes. | Below is the the instruction that describes the task:
### Input:
Return an axes dictionary for the passed axes.
### Response:
def _construct_axes_dict_from(self, axes, **kwargs):
"""Return an axes dictionary for the passed axes."""
d = {a: ax for a, ax in zip(self._AXIS_ORDERS, axes)}
d.upd... |
def delete_namespaced_replication_controller(self, name, namespace, **kwargs):
"""
delete a ReplicationController
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_namespaced_replicati... | delete a ReplicationController
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_namespaced_replication_controller(name, namespace, async_req=True)
>>> result = thread.get()
:param as... | Below is the the instruction that describes the task:
### Input:
delete a ReplicationController
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_namespaced_replication_controller(name, namespace,... |
def POST_AUTH(self, courseid): # pylint: disable=arguments-differ
""" GET request """
course, __ = self.get_course_and_check_rights(courseid)
user_input = web.input(tasks=[], aggregations=[], users=[])
if "filter_type" not in user_input or "type" not in user_input or "format" not in u... | GET request | Below is the the instruction that describes the task:
### Input:
GET request
### Response:
def POST_AUTH(self, courseid): # pylint: disable=arguments-differ
""" GET request """
course, __ = self.get_course_and_check_rights(courseid)
user_input = web.input(tasks=[], aggregations=[], users=... |
def alerts(self):
"""
Gets the Alerts API client.
Returns:
Alerts:
"""
if not self.__alerts:
self.__alerts = Alerts(self.__connection)
return self.__alerts | Gets the Alerts API client.
Returns:
Alerts: | Below is the the instruction that describes the task:
### Input:
Gets the Alerts API client.
Returns:
Alerts:
### Response:
def alerts(self):
"""
Gets the Alerts API client.
Returns:
Alerts:
"""
if not self.__alerts:
self.__alert... |
def fabric_route_mcast_rbridge_id_priority(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fabric = ET.SubElement(config, "fabric", xmlns="urn:brocade.com:mgmt:brocade-fabric-service")
route = ET.SubElement(fabric, "route")
mcast = ET.SubElement(... | Auto Generated Code | Below is the the instruction that describes the task:
### Input:
Auto Generated Code
### Response:
def fabric_route_mcast_rbridge_id_priority(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fabric = ET.SubElement(config, "fabric", xmlns="urn:brocade.com:mgm... |
def to_string(self, ast_obj=None, fmt: str = "medium") -> str:
"""Convert AST object to string
Args:
fmt (str): short, medium, long formatted BEL statements
short = short function and short relation format
medium = short function and long relation format
... | Convert AST object to string
Args:
fmt (str): short, medium, long formatted BEL statements
short = short function and short relation format
medium = short function and long relation format
long = long function and long relation format
cano... | Below is the the instruction that describes the task:
### Input:
Convert AST object to string
Args:
fmt (str): short, medium, long formatted BEL statements
short = short function and short relation format
medium = short function and long relation format
... |
def show_G_distribution(data):
'''Show the distribution of the G function.'''
Xs, t = fitting.preprocess_data(data)
Theta, Phi = np.meshgrid(np.linspace(0, np.pi, 50), np.linspace(0, 2 * np.pi, 50))
G = []
for i in range(len(Theta)):
G.append([])
for j in range(len(Theta[i])):
... | Show the distribution of the G function. | Below is the the instruction that describes the task:
### Input:
Show the distribution of the G function.
### Response:
def show_G_distribution(data):
'''Show the distribution of the G function.'''
Xs, t = fitting.preprocess_data(data)
Theta, Phi = np.meshgrid(np.linspace(0, np.pi, 50), np.linspace(... |
def enterprise_customer_required(view):
"""
Ensure the user making the API request is associated with an EnterpriseCustomer.
This decorator attempts to find an EnterpriseCustomer associated with the requesting
user and passes that EnterpriseCustomer to the view as a parameter. It will return a
Perm... | Ensure the user making the API request is associated with an EnterpriseCustomer.
This decorator attempts to find an EnterpriseCustomer associated with the requesting
user and passes that EnterpriseCustomer to the view as a parameter. It will return a
PermissionDenied error if an EnterpriseCustomer cannot b... | Below is the the instruction that describes the task:
### Input:
Ensure the user making the API request is associated with an EnterpriseCustomer.
This decorator attempts to find an EnterpriseCustomer associated with the requesting
user and passes that EnterpriseCustomer to the view as a parameter. It will ... |
def compose_from_srts(srts, search, searchtype):
"""Takes a list of subtitle (srt) filenames, search term and search type
and, returns a list of timestamps for composing a supercut.
"""
composition = []
foundSearchTerm = False
# Iterate over each subtitles file.
for srt in srts:
pr... | Takes a list of subtitle (srt) filenames, search term and search type
and, returns a list of timestamps for composing a supercut. | Below is the the instruction that describes the task:
### Input:
Takes a list of subtitle (srt) filenames, search term and search type
and, returns a list of timestamps for composing a supercut.
### Response:
def compose_from_srts(srts, search, searchtype):
"""Takes a list of subtitle (srt) filenames, sear... |
def invoke(cls, ns, banner): # pragma: nocover
"""
:param ns: local namespace
:param banner: interactive shell startup banner
Embed an interactive native python shell.
"""
import code
py_prefix = sys.platform.startswith('java') and 'J' or 'P'
shell_banne... | :param ns: local namespace
:param banner: interactive shell startup banner
Embed an interactive native python shell. | Below is the the instruction that describes the task:
### Input:
:param ns: local namespace
:param banner: interactive shell startup banner
Embed an interactive native python shell.
### Response:
def invoke(cls, ns, banner): # pragma: nocover
"""
:param ns: local namespace
... |
def add_find_links(self, urls):
"""Add `urls` to the list that will be prescanned for searches"""
for url in urls:
if (
self.to_scan is None # if we have already "gone online"
or not URL_SCHEME(url) # or it's a local file/directory
or url.sta... | Add `urls` to the list that will be prescanned for searches | Below is the the instruction that describes the task:
### Input:
Add `urls` to the list that will be prescanned for searches
### Response:
def add_find_links(self, urls):
"""Add `urls` to the list that will be prescanned for searches"""
for url in urls:
if (
self.to_scan... |
def snmp_server_v3host_notifytype(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
snmp_server = ET.SubElement(config, "snmp-server", xmlns="urn:brocade.com:mgmt:brocade-snmp")
v3host = ET.SubElement(snmp_server, "v3host")
hostip_key = ET.SubEleme... | Auto Generated Code | Below is the the instruction that describes the task:
### Input:
Auto Generated Code
### Response:
def snmp_server_v3host_notifytype(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
snmp_server = ET.SubElement(config, "snmp-server", xmlns="urn:brocade.com:mg... |
def del_host_comment(self, comment_id):
"""Delete a host comment
Format of the line that triggers function call::
DEL_HOST_COMMENT;<comment_id>
:param comment_id: comment id to delete
:type comment_id: int
:return: None
"""
for item in self.daemon.hosts:... | Delete a host comment
Format of the line that triggers function call::
DEL_HOST_COMMENT;<comment_id>
:param comment_id: comment id to delete
:type comment_id: int
:return: None | Below is the the instruction that describes the task:
### Input:
Delete a host comment
Format of the line that triggers function call::
DEL_HOST_COMMENT;<comment_id>
:param comment_id: comment id to delete
:type comment_id: int
:return: None
### Response:
def del_host_comm... |
def event_listen_stop(self):
'''Stop event_listen() loop from e.g. another thread.
Does nothing if libpulse poll is not running yet, so might be racey with
event_listen() - be sure to call it in a loop until event_listen returns or something.'''
self._loop_stop = True
c.pa.mainloop_wakeup(self._loop) | Stop event_listen() loop from e.g. another thread.
Does nothing if libpulse poll is not running yet, so might be racey with
event_listen() - be sure to call it in a loop until event_listen returns or something. | Below is the the instruction that describes the task:
### Input:
Stop event_listen() loop from e.g. another thread.
Does nothing if libpulse poll is not running yet, so might be racey with
event_listen() - be sure to call it in a loop until event_listen returns or something.
### Response:
def event_listen_s... |
def _destroy(self):
"""Destruction code to decrement counters"""
self.unuse_region()
if self._rlist is not None:
# Actual client count, which doesn't include the reference kept by the manager, nor ours
# as we are about to be deleted
try:
if l... | Destruction code to decrement counters | Below is the the instruction that describes the task:
### Input:
Destruction code to decrement counters
### Response:
def _destroy(self):
"""Destruction code to decrement counters"""
self.unuse_region()
if self._rlist is not None:
# Actual client count, which doesn't include th... |
def get_prev_sibling_tags(mention):
"""Return the HTML tag of the Mention's previous siblings.
Previous siblings are Mentions which are at the same level in the HTML tree
as the given mention, but are declared before the given mention. If a
candidate is passed in, only the previous siblings of its firs... | Return the HTML tag of the Mention's previous siblings.
Previous siblings are Mentions which are at the same level in the HTML tree
as the given mention, but are declared before the given mention. If a
candidate is passed in, only the previous siblings of its first Mention are
considered in the calcula... | Below is the the instruction that describes the task:
### Input:
Return the HTML tag of the Mention's previous siblings.
Previous siblings are Mentions which are at the same level in the HTML tree
as the given mention, but are declared before the given mention. If a
candidate is passed in, only the pre... |
def model_info(model_dir: Optional[str] = None) -> Tuple[str, bool]:
"""Retrieve Guesslang model directory name,
and tells if it is the default model.
:param model_dir: model location, if `None` default model is selected
:return: selected model directory with an indication
that the model is the... | Retrieve Guesslang model directory name,
and tells if it is the default model.
:param model_dir: model location, if `None` default model is selected
:return: selected model directory with an indication
that the model is the default or not | Below is the the instruction that describes the task:
### Input:
Retrieve Guesslang model directory name,
and tells if it is the default model.
:param model_dir: model location, if `None` default model is selected
:return: selected model directory with an indication
that the model is the defaul... |
def estimate_gas_for_function(
address,
web3,
fn_identifier=None,
transaction=None,
contract_abi=None,
fn_abi=None,
block_identifier=None,
*args,
**kwargs,
):
"""Temporary workaround until next web3.py release (5.X.X)"""
estimate_transactio... | Temporary workaround until next web3.py release (5.X.X) | Below is the the instruction that describes the task:
### Input:
Temporary workaround until next web3.py release (5.X.X)
### Response:
def estimate_gas_for_function(
address,
web3,
fn_identifier=None,
transaction=None,
contract_abi=None,
fn_abi=None,
block_id... |
def _lookup_namespace(self, symbol, namespace):
"""Helper for lookup_symbol that only looks up variables in a
namespace.
Args:
symbol: Symbol
namespace: pointer into self.namespaces
"""
for namespace_part in symbol.parts:
namespace = namespace.get... | Helper for lookup_symbol that only looks up variables in a
namespace.
Args:
symbol: Symbol
namespace: pointer into self.namespaces | Below is the the instruction that describes the task:
### Input:
Helper for lookup_symbol that only looks up variables in a
namespace.
Args:
symbol: Symbol
namespace: pointer into self.namespaces
### Response:
def _lookup_namespace(self, symbol, namespace):
"""Helper fo... |
def do_response(self, response_args=None, request=None, **kwargs):
"""
**Placeholder for the time being**
:param response_args:
:param request:
:param kwargs: request arguments
:return: Response information
"""
links = [Link(href=h, rel=OIC_ISSUER) for h... | **Placeholder for the time being**
:param response_args:
:param request:
:param kwargs: request arguments
:return: Response information | Below is the the instruction that describes the task:
### Input:
**Placeholder for the time being**
:param response_args:
:param request:
:param kwargs: request arguments
:return: Response information
### Response:
def do_response(self, response_args=None, request=None, **kwargs):
... |
def extract_queries(self, args, kwargs):
'''
This function normalizes the config block into a set of queries we
can use. The return is a list of consistently laid out dicts.
'''
# Please note the function signature is NOT an error. Neither args, nor
# kwargs should have... | This function normalizes the config block into a set of queries we
can use. The return is a list of consistently laid out dicts. | Below is the the instruction that describes the task:
### Input:
This function normalizes the config block into a set of queries we
can use. The return is a list of consistently laid out dicts.
### Response:
def extract_queries(self, args, kwargs):
'''
This function normalizes the config b... |
def attributive(adjective, gender=MALE, role=SUBJECT, article=None):
""" For a predicative adjective, returns the attributive form (lowercase).
In German, the attributive is formed with -e, -em, -en, -er or -es,
depending on gender (masculine, feminine, neuter or plural) and role
(nominative... | For a predicative adjective, returns the attributive form (lowercase).
In German, the attributive is formed with -e, -em, -en, -er or -es,
depending on gender (masculine, feminine, neuter or plural) and role
(nominative, accusative, dative, genitive). | Below is the the instruction that describes the task:
### Input:
For a predicative adjective, returns the attributive form (lowercase).
In German, the attributive is formed with -e, -em, -en, -er or -es,
depending on gender (masculine, feminine, neuter or plural) and role
(nominative, accusa... |
def hscan(self, key, cursor=0, match=None, count=None):
"""Incrementally iterate hash fields and associated values."""
args = [key, cursor]
match is not None and args.extend([b'MATCH', match])
count is not None and args.extend([b'COUNT', count])
fut = self.execute(b'HSCAN', *args... | Incrementally iterate hash fields and associated values. | Below is the the instruction that describes the task:
### Input:
Incrementally iterate hash fields and associated values.
### Response:
def hscan(self, key, cursor=0, match=None, count=None):
"""Incrementally iterate hash fields and associated values."""
args = [key, cursor]
match is not No... |
def create(cls, name=None, length=None, descendants=None, **kw):
"""
Create a new `Node` object.
:param name: Node label.
:param length: Branch length from the new node to its parent.
:param descendants: list of descendants or `None`.
:param kw: Additonal keyword argumen... | Create a new `Node` object.
:param name: Node label.
:param length: Branch length from the new node to its parent.
:param descendants: list of descendants or `None`.
:param kw: Additonal keyword arguments are passed through to `Node.__init__`.
:return: `Node` instance. | Below is the the instruction that describes the task:
### Input:
Create a new `Node` object.
:param name: Node label.
:param length: Branch length from the new node to its parent.
:param descendants: list of descendants or `None`.
:param kw: Additonal keyword arguments are passed th... |
def __query_cmd(self, command, device=None):
"""Calls a command"""
base_url = u'%s&switchcmd=%s' % (self.__homeauto_url_with_sid(), command)
if device is None:
url = base_url
else:
url = '%s&ain=%s' % (base_url, device)
if self.__debug:
print... | Calls a command | Below is the the instruction that describes the task:
### Input:
Calls a command
### Response:
def __query_cmd(self, command, device=None):
"""Calls a command"""
base_url = u'%s&switchcmd=%s' % (self.__homeauto_url_with_sid(), command)
if device is None:
url = base_url
... |
def _wrap_response(self, status=None, **kwargs):
"""Convenience method to wrap a status with any key word args.
Args:
status (enum): enum response status, defaults to OK
Returns:
dict: inlcudes a 'status' attribute and any key word arguments
"""
kwargs['... | Convenience method to wrap a status with any key word args.
Args:
status (enum): enum response status, defaults to OK
Returns:
dict: inlcudes a 'status' attribute and any key word arguments | Below is the the instruction that describes the task:
### Input:
Convenience method to wrap a status with any key word args.
Args:
status (enum): enum response status, defaults to OK
Returns:
dict: inlcudes a 'status' attribute and any key word arguments
### Response:
def ... |
def disable_rights(self):
"""
Disables rights management provided by :class:`fatbotslim.handlers.RightsHandler`.
"""
for handler in self.handlers:
if isinstance(handler, RightsHandler):
self.handlers.remove(handler)
break
self.rights = ... | Disables rights management provided by :class:`fatbotslim.handlers.RightsHandler`. | Below is the the instruction that describes the task:
### Input:
Disables rights management provided by :class:`fatbotslim.handlers.RightsHandler`.
### Response:
def disable_rights(self):
"""
Disables rights management provided by :class:`fatbotslim.handlers.RightsHandler`.
"""
for ... |
def context_register(self, func, *args):
"""
:term:`Context manager <context manager>` which temporarily registers a
filter function.
:param func: The filter function to register.
:param order: The sorting key for the filter function.
:rtype: :term:`context manager`
... | :term:`Context manager <context manager>` which temporarily registers a
filter function.
:param func: The filter function to register.
:param order: The sorting key for the filter function.
:rtype: :term:`context manager`
:return: Context manager which temporarily registers the ... | Below is the the instruction that describes the task:
### Input:
:term:`Context manager <context manager>` which temporarily registers a
filter function.
:param func: The filter function to register.
:param order: The sorting key for the filter function.
:rtype: :term:`context manag... |
def open(self):
""" Open connection.
"""
# Only connect once
if self._rpc is not None:
return self._rpc
# Get connection URL from rtorrent.rc
self.load_config()
# Reading abilities are on the downfall, so...
if not config.scgi_url:
... | Open connection. | Below is the the instruction that describes the task:
### Input:
Open connection.
### Response:
def open(self):
""" Open connection.
"""
# Only connect once
if self._rpc is not None:
return self._rpc
# Get connection URL from rtorrent.rc
self.load_config... |
def setImageItem(self, img):
"""Set an ImageItem to have its levels and LUT automatically controlled
by this HistogramLUTItem.
"""
self.imageItem = weakref.ref(img)
img.sigImageChanged.connect(self.imageChanged)
img.setLookupTable(self.getLookupTable) ## send function po... | Set an ImageItem to have its levels and LUT automatically controlled
by this HistogramLUTItem. | Below is the the instruction that describes the task:
### Input:
Set an ImageItem to have its levels and LUT automatically controlled
by this HistogramLUTItem.
### Response:
def setImageItem(self, img):
"""Set an ImageItem to have its levels and LUT automatically controlled
by this Histogra... |
async def do_authentication(sender):
"""
Executes the authentication process with the Telegram servers.
:param sender: a connected `MTProtoPlainSender`.
:return: returns a (authorization key, time offset) tuple.
"""
# Step 1 sending: PQ Request, endianness doesn't matter since it's random
n... | Executes the authentication process with the Telegram servers.
:param sender: a connected `MTProtoPlainSender`.
:return: returns a (authorization key, time offset) tuple. | Below is the the instruction that describes the task:
### Input:
Executes the authentication process with the Telegram servers.
:param sender: a connected `MTProtoPlainSender`.
:return: returns a (authorization key, time offset) tuple.
### Response:
async def do_authentication(sender):
"""
Execute... |
async def editNodeNdef(self, oldv, newv):
'''
Migration-only method
Notes:
Precondition: buid cache must be disabled
'''
assert self.buidcache.disabled
oldb = s_common.buid(oldv)
newb = s_common.buid(newv)
pvoldval = s_msgpack.en((oldb,))
... | Migration-only method
Notes:
Precondition: buid cache must be disabled | Below is the the instruction that describes the task:
### Input:
Migration-only method
Notes:
Precondition: buid cache must be disabled
### Response:
async def editNodeNdef(self, oldv, newv):
'''
Migration-only method
Notes:
Precondition: buid cache must be... |
def set_bios_settings(self, data=None, only_allowed_settings=True):
"""Sets current BIOS settings to the provided data.
:param: only_allowed_settings: True when only allowed BIOS settings
are to be set. If False, all the BIOS settings supported by
iLO and present in the ... | Sets current BIOS settings to the provided data.
:param: only_allowed_settings: True when only allowed BIOS settings
are to be set. If False, all the BIOS settings supported by
iLO and present in the 'data' are set.
:param: data: a dictionary of BIOS settings to be appli... | Below is the the instruction that describes the task:
### Input:
Sets current BIOS settings to the provided data.
:param: only_allowed_settings: True when only allowed BIOS settings
are to be set. If False, all the BIOS settings supported by
iLO and present in the 'data' are... |
def writefasta(self, fname):
""" Write sequences to FASTA formatted file"""
f = open(fname, "w")
fa_str = "\n".join([">%s\n%s" % (id, self._format_seq(seq)) for id, seq in self.items()])
f.write(fa_str)
f.close() | Write sequences to FASTA formatted file | Below is the the instruction that describes the task:
### Input:
Write sequences to FASTA formatted file
### Response:
def writefasta(self, fname):
""" Write sequences to FASTA formatted file"""
f = open(fname, "w")
fa_str = "\n".join([">%s\n%s" % (id, self._format_seq(seq)) for id, seq in ... |
def register_onchain_secret(
channel_state: NettingChannelState,
secret: Secret,
secrethash: SecretHash,
secret_reveal_block_number: BlockNumber,
delete_lock: bool = True,
) -> None:
"""This will register the onchain secret and set the lock to the unlocked stated.
Even t... | This will register the onchain secret and set the lock to the unlocked stated.
Even though the lock is unlocked it is *not* claimed. The capacity will
increase once the next balance proof is received. | Below is the the instruction that describes the task:
### Input:
This will register the onchain secret and set the lock to the unlocked stated.
Even though the lock is unlocked it is *not* claimed. The capacity will
increase once the next balance proof is received.
### Response:
def register_onchain_secre... |
def get_audits():
"""Get OS hardening apt audits.
:returns: dictionary of audits
"""
audits = [AptConfig([{'key': 'APT::Get::AllowUnauthenticated',
'expected': 'false'}])]
settings = get_settings('os')
clean_packages = settings['security']['packages_clean']
if cl... | Get OS hardening apt audits.
:returns: dictionary of audits | Below is the the instruction that describes the task:
### Input:
Get OS hardening apt audits.
:returns: dictionary of audits
### Response:
def get_audits():
"""Get OS hardening apt audits.
:returns: dictionary of audits
"""
audits = [AptConfig([{'key': 'APT::Get::AllowUnauthenticated',
... |
def create_append_blob_service(self):
'''
Creates a AppendBlobService object with the settings specified in the
CloudStorageAccount.
:return: A service object.
:rtype: :class:`~azure.storage.blob.appendblobservice.AppendBlobService`
'''
try:
from azu... | Creates a AppendBlobService object with the settings specified in the
CloudStorageAccount.
:return: A service object.
:rtype: :class:`~azure.storage.blob.appendblobservice.AppendBlobService` | Below is the the instruction that describes the task:
### Input:
Creates a AppendBlobService object with the settings specified in the
CloudStorageAccount.
:return: A service object.
:rtype: :class:`~azure.storage.blob.appendblobservice.AppendBlobService`
### Response:
def create_append_b... |
def pdf(self, phi):
r"""
Evaluate the flow PDF `dN/d\phi`.
:param array-like phi: Azimuthal angles.
:returns: The flow PDF evaluated at ``phi``.
"""
if self._n is None:
pdf = np.empty_like(phi)
pdf.fill(.5/np.pi)
return pdf
... | r"""
Evaluate the flow PDF `dN/d\phi`.
:param array-like phi: Azimuthal angles.
:returns: The flow PDF evaluated at ``phi``. | Below is the the instruction that describes the task:
### Input:
r"""
Evaluate the flow PDF `dN/d\phi`.
:param array-like phi: Azimuthal angles.
:returns: The flow PDF evaluated at ``phi``.
### Response:
def pdf(self, phi):
r"""
Evaluate the flow PDF `dN/d\phi`.
:... |
def _violinplot(val, shade, bw, ax, **kwargs_shade):
"""Auxiliary function to plot violinplots."""
density, low_b, up_b = _fast_kde(val, bw=bw)
x = np.linspace(low_b, up_b, len(density))
x = np.concatenate([x, x[::-1]])
density = np.concatenate([-density, density[::-1]])
ax.fill_betweenx(x, de... | Auxiliary function to plot violinplots. | Below is the the instruction that describes the task:
### Input:
Auxiliary function to plot violinplots.
### Response:
def _violinplot(val, shade, bw, ax, **kwargs_shade):
"""Auxiliary function to plot violinplots."""
density, low_b, up_b = _fast_kde(val, bw=bw)
x = np.linspace(low_b, up_b, len(density... |
def _request(self):
"""Request wrapper
:return: SnowRequest object
"""
parameters = copy(self.parameters)
return SnowRequest(url_builder=self._url_builder, parameters=parameters, resource=self, **self.kwargs) | Request wrapper
:return: SnowRequest object | Below is the the instruction that describes the task:
### Input:
Request wrapper
:return: SnowRequest object
### Response:
def _request(self):
"""Request wrapper
:return: SnowRequest object
"""
parameters = copy(self.parameters)
return SnowRequest(url_builder=sel... |
def clone(self, parse_ligands = False):
'''A function to replace the old constructor call where a PDB object was passed in and 'cloned'.'''
return PDB("\n".join(self.lines), pdb_id = self.pdb_id, strict = self.strict, parse_ligands = parse_ligands) | A function to replace the old constructor call where a PDB object was passed in and 'cloned'. | Below is the the instruction that describes the task:
### Input:
A function to replace the old constructor call where a PDB object was passed in and 'cloned'.
### Response:
def clone(self, parse_ligands = False):
'''A function to replace the old constructor call where a PDB object was passed in and 'cloned... |
def upload_rotate(file_path, s3_bucket, s3_key_prefix, aws_key=None, aws_secret=None):
'''
Upload file_path to s3 bucket with prefix
Ex. upload_rotate('/tmp/file-2015-01-01.tar.bz2', 'backups', 'foo.net/')
would upload file to bucket backups with key=foo.net/file-2015-01-01.tar.bz2
and then rotate a... | Upload file_path to s3 bucket with prefix
Ex. upload_rotate('/tmp/file-2015-01-01.tar.bz2', 'backups', 'foo.net/')
would upload file to bucket backups with key=foo.net/file-2015-01-01.tar.bz2
and then rotate all files starting with foo.net/file and with extension .tar.bz2
Timestamps need to be present b... | Below is the the instruction that describes the task:
### Input:
Upload file_path to s3 bucket with prefix
Ex. upload_rotate('/tmp/file-2015-01-01.tar.bz2', 'backups', 'foo.net/')
would upload file to bucket backups with key=foo.net/file-2015-01-01.tar.bz2
and then rotate all files starting with foo.net... |
def sensor_offsets_send(self, mag_ofs_x, mag_ofs_y, mag_ofs_z, mag_declination, raw_press, raw_temp, gyro_cal_x, gyro_cal_y, gyro_cal_z, accel_cal_x, accel_cal_y, accel_cal_z, force_mavlink1=False):
'''
Offsets and calibrations values for hardware sensors. This makes it
e... | Offsets and calibrations values for hardware sensors. This makes it
easier to debug the calibration process.
mag_ofs_x : magnetometer X offset (int16_t)
mag_ofs_y : magnetometer Y offset (int16_t)
mag_ofs_z ... | Below is the the instruction that describes the task:
### Input:
Offsets and calibrations values for hardware sensors. This makes it
easier to debug the calibration process.
mag_ofs_x : magnetometer X offset (int16_t)
mag_ofs_y : magne... |
def addRecord(self, record):
"""
Adds the given record to the system.
:param record | <str>
"""
label_mapper = self.labelMapper()
icon_mapper = self.iconMapper()
self.addItem(label_mapper(record))
self.setItemData(se... | Adds the given record to the system.
:param record | <str> | Below is the the instruction that describes the task:
### Input:
Adds the given record to the system.
:param record | <str>
### Response:
def addRecord(self, record):
"""
Adds the given record to the system.
:param record | <str>
"""
... |
def simple_callable(decorator):
'''Decorator used to create consistent decorators.
Consistent in the meaning that the wrapper do not have to
care if the wrapped callable is a function or a method,
it will always receive a valid callable.
If the decorator is used with a function, the wrapper will
... | Decorator used to create consistent decorators.
Consistent in the meaning that the wrapper do not have to
care if the wrapped callable is a function or a method,
it will always receive a valid callable.
If the decorator is used with a function, the wrapper will
receive the function itself, but if th... | Below is the the instruction that describes the task:
### Input:
Decorator used to create consistent decorators.
Consistent in the meaning that the wrapper do not have to
care if the wrapped callable is a function or a method,
it will always receive a valid callable.
If the decorator is used with a ... |
def _normalizePoint(self, x, y):
"""Check if a point is in bounds and make minor adjustments.
Respects Pythons negative indexes. -1 starts at the bottom right.
Replaces the _drawable function
"""
# cast to int, always faster than type checking
x = int(x)
y = int... | Check if a point is in bounds and make minor adjustments.
Respects Pythons negative indexes. -1 starts at the bottom right.
Replaces the _drawable function | Below is the the instruction that describes the task:
### Input:
Check if a point is in bounds and make minor adjustments.
Respects Pythons negative indexes. -1 starts at the bottom right.
Replaces the _drawable function
### Response:
def _normalizePoint(self, x, y):
"""Check if a point i... |
def SetBuddyStatusPendingAuthorization(self, Text=u''):
"""Sets the BuddyStaus property to `enums.budPendingAuthorization`
additionally specifying the authorization text.
:Parameters:
Text : unicode
The authorization text.
:see: `BuddyStatus`
"""
s... | Sets the BuddyStaus property to `enums.budPendingAuthorization`
additionally specifying the authorization text.
:Parameters:
Text : unicode
The authorization text.
:see: `BuddyStatus` | Below is the the instruction that describes the task:
### Input:
Sets the BuddyStaus property to `enums.budPendingAuthorization`
additionally specifying the authorization text.
:Parameters:
Text : unicode
The authorization text.
:see: `BuddyStatus`
### Response:
def ... |
def _get_covars(self):
"""Covariance parameters for each mixture component.
The shape depends on `cvtype`::
(`n_states`, 'n_features') if 'spherical',
(`n_features`, `n_features`) if 'tied',
(`n_states`, `n_features`) if 'di... | Covariance parameters for each mixture component.
The shape depends on `cvtype`::
(`n_states`, 'n_features') if 'spherical',
(`n_features`, `n_features`) if 'tied',
(`n_states`, `n_features`) if 'diag',
(`n_states`, `n_f... | Below is the the instruction that describes the task:
### Input:
Covariance parameters for each mixture component.
The shape depends on `cvtype`::
(`n_states`, 'n_features') if 'spherical',
(`n_features`, `n_features`) if 'tied',
(`n_states`, ... |
def data_from_bytes(self, byte_representation):
"""
Converts the given bytes representation to resource data.
"""
text = byte_representation.decode(self.encoding)
return self.data_from_string(text) | Converts the given bytes representation to resource data. | Below is the the instruction that describes the task:
### Input:
Converts the given bytes representation to resource data.
### Response:
def data_from_bytes(self, byte_representation):
"""
Converts the given bytes representation to resource data.
"""
text = byte_representation.decod... |
def splitext(path):
"""splitext for paths with directories that may contain dots.
From https://stackoverflow.com/questions/5930036/separating-file-extensions-using-python-os-path-module"""
li = []
path_without_extensions = os.path.join(os.path.dirname(path),
os.path.basename(path).split(os.extse... | splitext for paths with directories that may contain dots.
From https://stackoverflow.com/questions/5930036/separating-file-extensions-using-python-os-path-module | Below is the the instruction that describes the task:
### Input:
splitext for paths with directories that may contain dots.
From https://stackoverflow.com/questions/5930036/separating-file-extensions-using-python-os-path-module
### Response:
def splitext(path):
"""splitext for paths with directories that m... |
def _setLogicalOperator(self, lop):
"""Sets the way the find fields should be combined together."""
if not lop.lower() in ['and', 'or']:
raise FMError, 'Unsupported logical operator (not one of "and" or "or").'
self._lop = lop.lower() | Sets the way the find fields should be combined together. | Below is the the instruction that describes the task:
### Input:
Sets the way the find fields should be combined together.
### Response:
def _setLogicalOperator(self, lop):
"""Sets the way the find fields should be combined together."""
if not lop.lower() in ['and', 'or']:
raise FMError, 'Unsupported logic... |
def network_list(self):
'''
List extra private networks
'''
nt_ks = self.compute_conn
return [network.__dict__ for network in nt_ks.networks.list()] | List extra private networks | Below is the the instruction that describes the task:
### Input:
List extra private networks
### Response:
def network_list(self):
'''
List extra private networks
'''
nt_ks = self.compute_conn
return [network.__dict__ for network in nt_ks.networks.list()] |
def kallisto_alignment_plot (self):
""" Make the HighCharts HTML to plot the alignment rates """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['pseudoaligned_reads'] = { 'color': '#437bb1', 'name': 'Pseudoaligned' }
keys['not_pseudoaligned_re... | Make the HighCharts HTML to plot the alignment rates | Below is the the instruction that describes the task:
### Input:
Make the HighCharts HTML to plot the alignment rates
### Response:
def kallisto_alignment_plot (self):
""" Make the HighCharts HTML to plot the alignment rates """
# Specify the order of the different possible categories
keys... |
def ght(img, template):
r"""
Implementation of the general hough transform for all dimensions.
Providing a template, this method searches in the image for structures similar to the
one depicted by the template. The returned hough image denotes how well the structure
fit in each index.
... | r"""
Implementation of the general hough transform for all dimensions.
Providing a template, this method searches in the image for structures similar to the
one depicted by the template. The returned hough image denotes how well the structure
fit in each index.
The indices of the returned ... | Below is the the instruction that describes the task:
### Input:
r"""
Implementation of the general hough transform for all dimensions.
Providing a template, this method searches in the image for structures similar to the
one depicted by the template. The returned hough image denotes how well the s... |
def __public_objs(self):
"""
Returns a dictionary mapping a public identifier name to a
Python object. This counts the `__init__` method as being
public.
"""
_budoc = getattr(self.module.module, '__budoc__', {})
def forced_out(name):
return _budoc.get... | Returns a dictionary mapping a public identifier name to a
Python object. This counts the `__init__` method as being
public. | Below is the the instruction that describes the task:
### Input:
Returns a dictionary mapping a public identifier name to a
Python object. This counts the `__init__` method as being
public.
### Response:
def __public_objs(self):
"""
Returns a dictionary mapping a public identifier n... |
def predict_proba(self, X):
"""Return the output of the module's forward method as a numpy
array.
If the module's forward method returns multiple outputs as a
tuple, it is assumed that the first output contains the
relevant information and the other values are ignored. If all
... | Return the output of the module's forward method as a numpy
array.
If the module's forward method returns multiple outputs as a
tuple, it is assumed that the first output contains the
relevant information and the other values are ignored. If all
values are relevant, consider usi... | Below is the the instruction that describes the task:
### Input:
Return the output of the module's forward method as a numpy
array.
If the module's forward method returns multiple outputs as a
tuple, it is assumed that the first output contains the
relevant information and the other... |
def fts(self, segment):
"""Return features corresponding to segment as list of (value,
feature) tuples
Args:
segment (unicode): segment for which features are to be returned as
Unicode string
Returns:
list: None if `segment` cannot... | Return features corresponding to segment as list of (value,
feature) tuples
Args:
segment (unicode): segment for which features are to be returned as
Unicode string
Returns:
list: None if `segment` cannot be parsed; otherwise, a list of th... | Below is the the instruction that describes the task:
### Input:
Return features corresponding to segment as list of (value,
feature) tuples
Args:
segment (unicode): segment for which features are to be returned as
Unicode string
Returns:
... |
def _ProduceSingleContent(self, mod, showprivate=False, showinh=False):
"""An internal helper to create a page for a single module. This will
automatically generate the needed RSF to document the module
and save the module to its own page in its appropriate location.
Args:
m... | An internal helper to create a page for a single module. This will
automatically generate the needed RSF to document the module
and save the module to its own page in its appropriate location.
Args:
mod (module): The single module to document as its own page
showprivate ... | Below is the the instruction that describes the task:
### Input:
An internal helper to create a page for a single module. This will
automatically generate the needed RSF to document the module
and save the module to its own page in its appropriate location.
Args:
mod (module): T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.