_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q12400 | PointCloudImage.open | train | def open(filename, frame='unspecified'):
"""Creates a PointCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing ... | python | {
"resource": ""
} |
q12401 | NormalCloudImage.to_normal_cloud | train | def to_normal_cloud(self):
"""Convert the image to a NormalCloud object.
Returns
-------
:obj:`autolab_core.NormalCloud`
The corresponding NormalCloud.
"""
return NormalCloud(
data=self._data.reshape(
self.height *
... | python | {
"resource": ""
} |
q12402 | NormalCloudImage.open | train | def open(filename, frame='unspecified'):
"""Creates a NormalCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing... | python | {
"resource": ""
} |
q12403 | OrthographicIntrinsics.deproject | train | def deproject(self, depth_image):
"""Deprojects a DepthImage into a PointCloud.
Parameters
----------
depth_image : :obj:`DepthImage`
The 2D depth image to projet into a point cloud.
Returns
-------
:obj:`autolab_core.PointCloud`
A 3D poi... | python | {
"resource": ""
} |
q12404 | OrthographicIntrinsics.deproject_pixel | train | def deproject_pixel(self, depth, pixel):
"""Deprojects a single pixel with a given depth into a 3D point.
Parameters
----------
depth : float
The depth value at the given pixel location.
pixel : :obj:`autolab_core.Point`
A 2D point representing the pixel... | python | {
"resource": ""
} |
q12405 | OrthographicIntrinsics.save | train | def save(self, filename):
"""Save the CameraIntrinsics object to a .intr file.
Parameters
----------
filename : :obj:`str`
The .intr file to save the object to.
Raises
------
ValueError
If filename does not have the .intr extension.
... | python | {
"resource": ""
} |
q12406 | PhoXiSensor._connect_to_sensor | train | def _connect_to_sensor(self):
"""Connect to the sensor.
"""
name = self._device_name
try:
# Check if device is actively in list
rospy.wait_for_service('phoxi_camera/get_device_list')
device_list = rospy.ServiceProxy('phoxi_camera/get_device_list', GetD... | python | {
"resource": ""
} |
q12407 | PhoXiSensor._depth_im_callback | train | def _depth_im_callback(self, msg):
"""Callback for handling depth images.
"""
try:
self._cur_depth_im = DepthImage(self._bridge.imgmsg_to_cv2(msg) / 1000.0, frame=self._frame)
except:
self._cur_depth_im = None | python | {
"resource": ""
} |
q12408 | PhoXiSensor._normal_map_callback | train | def _normal_map_callback(self, msg):
"""Callback for handling normal maps.
"""
try:
self._cur_normal_map = self._bridge.imgmsg_to_cv2(msg)
except:
self._cur_normal_map = None | python | {
"resource": ""
} |
q12409 | RgbdDetection.image | train | def image(self, render_mode):
""" Get the image associated with a particular render mode """
if render_mode == RenderMode.SEGMASK:
return self.query_im
elif render_mode == RenderMode.COLOR:
return self.color_im
elif render_mode == RenderMode.DEPTH:
ret... | python | {
"resource": ""
} |
q12410 | RgbdDetectorFactory.detector | train | def detector(detector_type):
""" Returns a detector of the specified type. """
if detector_type == 'point_cloud_box':
return PointCloudBoxDetector()
elif detector_type == 'rgbd_foreground_mask_query':
return RgbdForegroundMaskQueryImageDetector()
elif detector_typ... | python | {
"resource": ""
} |
q12411 | AlexNet._parse_config | train | def _parse_config(self, config):
""" Parses a tensorflow configuration """
self._batch_size = config['batch_size']
self._im_height = config['im_height']
self._im_width = config['im_width']
self._num_channels = config['channels']
self._output_layer = config['out_layer']
... | python | {
"resource": ""
} |
q12412 | AlexNet._load | train | def _load(self):
""" Loads a model into weights """
if self._model_filename is None:
raise ValueError('Model filename not specified')
# read the input image
self._graph = tf.Graph()
with self._graph.as_default():
# read in filenames
reader = t... | python | {
"resource": ""
} |
q12413 | AlexNet._initialize | train | def _initialize(self):
""" Open from caffe weights """
self._graph = tf.Graph()
with self._graph.as_default():
self._input_node = tf.placeholder(tf.float32, (self._batch_size, self._im_height, self._im_width, self._num_channels))
weights = self.build_alexnet_weights()
... | python | {
"resource": ""
} |
q12414 | AlexNet.open_session | train | def open_session(self):
""" Open tensorflow session. Exposed for memory management. """
with self._graph.as_default():
init = tf.initialize_all_variables()
self._sess = tf.Session()
self._sess.run(init) | python | {
"resource": ""
} |
q12415 | AlexNet.close_session | train | def close_session(self):
""" Close tensorflow session. Exposes for memory management. """
with self._graph.as_default():
self._sess.close()
self._sess = None | python | {
"resource": ""
} |
q12416 | AlexNet.predict | train | def predict(self, image_arr, featurize=False):
""" Predict a set of images in batches.
Parameters
----------
image_arr : NxHxWxC :obj:`numpy.ndarray`
input set of images in a num_images x image height x image width x image channels array (must match parameters of network)
... | python | {
"resource": ""
} |
q12417 | AlexNet.build_alexnet_weights | train | def build_alexnet_weights(self):
""" Build a set of convnet weights for AlexNet """
net_data = self._net_data
#conv1
#conv(11, 11, 96, 4, 4, padding='VALID', name='conv1')
k_h = 11; k_w = 11; c_o = 96; s_h = 4; s_w = 4
conv1W = tf.Variable(net_data["conv1"][0])
co... | python | {
"resource": ""
} |
q12418 | CNNBatchFeatureExtractor._forward_pass | train | def _forward_pass(self, images):
""" Forward pass a list of images through the CNN """
# form image array
num_images = len(images)
if num_images == 0:
return None
for image in images:
if not isinstance(image, Image):
new_images = []
... | python | {
"resource": ""
} |
q12419 | Engine.repositories | train | def repositories(self):
"""
Returns a DataFrame with the data about the repositories found at
the specified repositories path in the form of siva files.
>>> repos_df = engine.repositories
:rtype: RepositoriesDataFrame
"""
return RepositoriesDataFrame(self.__engi... | python | {
"resource": ""
} |
q12420 | Engine.blobs | train | def blobs(self, repository_ids=[], reference_names=[], commit_hashes=[]):
"""
Retrieves the blobs of a list of repositories, reference names and commit hashes.
So the result will be a DataFrame of all the blobs in the given commits that are
in the given references that belong to the give... | python | {
"resource": ""
} |
q12421 | Engine.from_metadata | train | def from_metadata(self, db_path, db_name='engine_metadata.db'):
"""
Registers in the current session the views of the MetadataSource so the
data is obtained from the metadata database instead of reading the
repositories with the DefaultSource.
:param db_path: path to the folder ... | python | {
"resource": ""
} |
q12422 | SourcedDataFrame.__generate_method | train | def __generate_method(name):
"""
Wraps the DataFrame's original method by name to return the derived class instance.
"""
try:
func = getattr(DataFrame, name)
except AttributeError as e:
# PySpark version is too old
def func(self, *args, **kwarg... | python | {
"resource": ""
} |
q12423 | RepositoriesDataFrame.references | train | def references(self):
"""
Returns the joined DataFrame of references and repositories.
>>> refs_df = repos_df.references
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getReferences(),
self._session, ... | python | {
"resource": ""
} |
q12424 | RepositoriesDataFrame.remote_references | train | def remote_references(self):
"""
Returns a new DataFrame with only the remote references of the
current repositories.
>>> remote_refs_df = repos_df.remote_references
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getRemoteRefer... | python | {
"resource": ""
} |
q12425 | RepositoriesDataFrame.master_ref | train | def master_ref(self):
"""
Filters the current DataFrame references to only contain those rows whose reference is master.
>>> master_df = repos_df.master_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getReferences().getHEAD(),
... | python | {
"resource": ""
} |
q12426 | ReferencesDataFrame.head_ref | train | def head_ref(self):
"""
Filters the current DataFrame to only contain those rows whose reference is HEAD.
>>> heads_df = refs_df.head_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getHEAD(),
self... | python | {
"resource": ""
} |
q12427 | ReferencesDataFrame.master_ref | train | def master_ref(self):
"""
Filters the current DataFrame to only contain those rows whose reference is master.
>>> master_df = refs_df.master_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getMaster(),
... | python | {
"resource": ""
} |
q12428 | ReferencesDataFrame.ref | train | def ref(self, ref):
"""
Filters the current DataFrame to only contain those rows whose reference is the given
reference name.
>>> heads_df = refs_df.ref('refs/heads/HEAD')
:param ref: Reference to get
:type ref: str
:rtype: ReferencesDataFrame
"""
... | python | {
"resource": ""
} |
q12429 | ReferencesDataFrame.all_reference_commits | train | def all_reference_commits(self):
"""
Returns the current DataFrame joined with the commits DataFrame, with all of the commits
in all references.
>>> commits_df = refs_df.all_reference_commits
Take into account that getting all the commits will lead to a lot of repeated tree
... | python | {
"resource": ""
} |
q12430 | ReferencesDataFrame.blobs | train | def blobs(self):
"""
Returns this DataFrame joined with the blobs DataSource.
>>> blobs_df = refs_df.blobs
:rtype: BlobsDataFrame
"""
return BlobsDataFrame(self._engine_dataframe.getBlobs(), self._session, self._implicits) | python | {
"resource": ""
} |
q12431 | CommitsDataFrame.tree_entries | train | def tree_entries(self):
"""
Returns this DataFrame joined with the tree entries DataSource.
>>> entries_df = commits_df.tree_entries
:rtype: TreeEntriesDataFrame
"""
return TreeEntriesDataFrame(self._engine_dataframe.getTreeEntries(), self._session, self._implicits) | python | {
"resource": ""
} |
q12432 | BlobsDataFrame.classify_languages | train | def classify_languages(self):
"""
Returns a new DataFrame with the language data of any blob added to
its row.
>>> blobs_lang_df = blobs_df.classify_languages
:rtype: BlobsWithLanguageDataFrame
"""
return BlobsWithLanguageDataFrame(self._engine_dataframe.classif... | python | {
"resource": ""
} |
q12433 | BlobsDataFrame.extract_uasts | train | def extract_uasts(self):
"""
Returns a new DataFrame with the parsed UAST data of any blob added to
its row.
>>> blobs_df.extract_uasts
:rtype: UASTsDataFrame
"""
return UASTsDataFrame(self._engine_dataframe.extractUASTs(),
self._se... | python | {
"resource": ""
} |
q12434 | UASTsDataFrame.query_uast | train | def query_uast(self, query, query_col='uast', output_col='result'):
"""
Queries the UAST of a file with the given query to get specific nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', 'foo', 'bar')
:... | python | {
"resource": ""
} |
q12435 | UASTsDataFrame.extract_tokens | train | def extract_tokens(self, input_col='result', output_col='tokens'):
"""
Extracts the tokens from UAST nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').extract_tokens().collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', output_col='foo').extract_tokens('foo', 'b... | python | {
"resource": ""
} |
q12436 | GSBlobStore.delete | train | def delete(self, bucket: str, key: str):
"""
Deletes an object in a bucket. If the operation definitely did not delete anything, return False. Any other
return value is treated as something was possibly deleted.
"""
bucket_obj = self._ensure_bucket_loaded(bucket)
try:
... | python | {
"resource": ""
} |
q12437 | API_WRAPPER.request | train | def request(self, shards, full_response, return_status_tuple=False):
"""Request the API
This method is wrapped by similar functions
"""
try:
resp = self._request(shards)
if return_status_tuple:
return (self._parser(resp, full_response), True)
... | python | {
"resource": ""
} |
q12438 | API_WRAPPER.command | train | def command(self, command, full_response=False, **kwargs): # pragma: no cover
"""Method Interface to the command API for Nationstates"""
command = Shard(c=command)
return self.get_shards(*(command, Shard(**kwargs)), full_response=full_response) | python | {
"resource": ""
} |
q12439 | Nation.send_telegram | train | def send_telegram(telegram=None, client_key=None, tgid=None, key=None): # pragma: no cover
"""Sends Telegram. Can either provide a telegram directly, or provide the api details and created internally
"""
if telegram:
pass
else:
telegram = self.api_mot... | python | {
"resource": ""
} |
q12440 | Nation.verify | train | def verify(self, checksum=None, token=None, full_response=False):
"""Wraps around the verify API"""
payload = {"checksum":checksum, "a":"verify"}
if token:
payload.update({"token":token})
return self.get_shards(Shard(**payload), full_response=True) | python | {
"resource": ""
} |
q12441 | BlobStore.upload_file_handle | train | def upload_file_handle(
self,
bucket: str,
key: str,
src_file_handle: typing.BinaryIO,
content_type: str=None,
metadata: dict=None):
"""
Saves the contents of a file handle as the contents of an object in a bucket.
"""
... | python | {
"resource": ""
} |
q12442 | S3BlobStore.find_next_missing_parts | train | def find_next_missing_parts(
self,
bucket: str,
key: str,
upload_id: str,
part_count: int,
search_start: int=1,
return_count: int=1) -> typing.Sequence[int]:
"""
Given a `bucket`, `key`, and `upload_id`, find the next N ... | python | {
"resource": ""
} |
q12443 | scanf_compile | train | def scanf_compile(format, collapseWhitespace=True):
"""
Translate the format into a regular expression
For example:
>>> format_re, casts = scanf_compile('%s - %d errors, %d warnings')
>>> print format_re.pattern
(\S+) \- ([+-]?\d+) errors, ([+-]?\d+) warnings
Translated formats are cached ... | python | {
"resource": ""
} |
q12444 | extractdata | train | def extractdata(pattern, text=None, filepath=None):
"""
Read through an entire file or body of text one line at a time. Parse each line that matches the supplied
pattern string and ignore the rest.
If *text* is supplied, it will be parsed according to the *pattern* string.
If *text* is not supplied... | python | {
"resource": ""
} |
q12445 | Nationstates.nation | train | def nation(self, nation_name, password=None, autologin=None):
"""Setup access to the Nation API with the Nation object
:param nation_name: Name of the nation
:param password: (Optional) password for this nation
:param autologin (Optional) autologin for this nation
... | python | {
"resource": ""
} |
q12446 | Nationstates.wa | train | def wa(self, chamber):
"""Setup access to the World Assembly API with the WorldAssembly object
:param chamber: Chamber of the WA
:type chamber: str, int
:returns: WorldAssembly Object based off region_name
:rtype: WorldAssembly
"""
if ... | python | {
"resource": ""
} |
q12447 | apply_patch | train | def apply_patch(diffs):
""" Not ready for use yet """
pass
if isinstance(diffs, patch.diff):
diffs = [diffs]
for diff in diffs:
if diff.header.old_path == '/dev/null':
text = []
else:
with open(diff.header.old_path) as f:
text = f.read()
... | python | {
"resource": ""
} |
q12448 | b64decode_url | train | def b64decode_url(istr):
""" JWT Tokens may be truncated without the usual trailing padding '='
symbols. Compensate by padding to the nearest 4 bytes.
"""
istr = encode_safe(istr)
try:
return urlsafe_b64decode(istr + '=' * (4 - (len(istr) % 4)))
except TypeError as e:
raise E... | python | {
"resource": ""
} |
q12449 | _validate | train | def _validate(claims, validate_claims, expiry_seconds):
""" Validate expiry related claims.
If validate_claims is False, do nothing.
Otherwise, validate the exp and nbf claims if they are present, and
validate the iat claim if expiry_seconds is provided.
"""
if not validate_claims:
ret... | python | {
"resource": ""
} |
q12450 | gauge | train | def gauge(key, gauge=None, default=float("nan"), **dims):
"""Adds gauge with dimensions to the global pyformance registry"""
return global_registry().gauge(key, gauge=gauge, default=default, **dims) | python | {
"resource": ""
} |
q12451 | count_calls_with_dims | train | def count_calls_with_dims(**dims):
"""Decorator to track the number of times a function is called
with with dimensions.
"""
def counter_wrapper(fn):
@functools.wraps(fn)
def fn_wrapper(*args, **kwargs):
counter("%s_calls" %
pyformance.registry.get_qualname... | python | {
"resource": ""
} |
q12452 | meter_calls_with_dims | train | def meter_calls_with_dims(**dims):
"""Decorator to track the rate at which a function is called
with dimensions.
"""
def meter_wrapper(fn):
@functools.wraps(fn)
def fn_wrapper(*args, **kwargs):
meter("%s_calls" %
pyformance.registry.get_qualname(fn), **dims)... | python | {
"resource": ""
} |
q12453 | hist_calls | train | def hist_calls(fn):
"""
Decorator to check the distribution of return values of a function.
"""
@functools.wraps(fn)
def wrapper(*args, **kwargs):
_histogram = histogram(
"%s_calls" % pyformance.registry.get_qualname(fn))
rtn = fn(*args, **kwargs)
if type(rtn) in ... | python | {
"resource": ""
} |
q12454 | hist_calls_with_dims | train | def hist_calls_with_dims(**dims):
"""Decorator to check the distribution of return values of a
function with dimensions.
"""
def hist_wrapper(fn):
@functools.wraps(fn)
def fn_wrapper(*args, **kwargs):
_histogram = histogram(
"%s_calls" % pyformance.registry.ge... | python | {
"resource": ""
} |
q12455 | time_calls_with_dims | train | def time_calls_with_dims(**dims):
"""Decorator to time the execution of the function with dimensions."""
def time_wrapper(fn):
@functools.wraps(fn)
def fn_wrapper(*args, **kwargs):
_timer = timer("%s_calls" %
pyformance.registry.get_qualname(fn), **dims)
... | python | {
"resource": ""
} |
q12456 | MetricsRegistry.add | train | def add(self, key, metric, **dims):
"""Adds custom metric instances to the registry with dimensions
which are not created with their constructors default arguments
"""
return super(MetricsRegistry, self).add(
self.metadata.register(key, **dims), metric) | python | {
"resource": ""
} |
q12457 | _BaseSignalFxIngestClient.send | train | def send(self, cumulative_counters=None, gauges=None, counters=None):
"""Send the given metrics to SignalFx.
Args:
cumulative_counters (list): a list of dictionaries representing the
cumulative counters to report.
gauges (list): a list of dictionaries representin... | python | {
"resource": ""
} |
q12458 | _BaseSignalFxIngestClient.send_event | train | def send_event(self, event_type, category=None, dimensions=None,
properties=None, timestamp=None):
"""Send an event to SignalFx.
Args:
event_type (string): the event type (name of the event time
series).
category (string): the category of the e... | python | {
"resource": ""
} |
q12459 | _BaseSignalFxIngestClient.stop | train | def stop(self, msg='Thread stopped'):
"""Stop send thread and flush points for a safe exit."""
with self._lock:
if not self._thread_running:
return
self._thread_running = False
self._queue.put(_BaseSignalFxIngestClient._QUEUE_STOP)
self._send_threa... | python | {
"resource": ""
} |
q12460 | ProtoBufSignalFxIngestClient._assign_value_by_type | train | def _assign_value_by_type(self, pbuf_obj, value, _bool=True, _float=True,
_integer=True, _string=True, error_prefix=''):
"""Assigns the supplied value to the appropriate protobuf value type"""
# bool inherits int, so bool instance check must be executed prior to
# c... | python | {
"resource": ""
} |
q12461 | ProtoBufSignalFxIngestClient._assign_value | train | def _assign_value(self, pbuf_dp, value):
"""Assigns a value to the protobuf obj"""
self._assign_value_by_type(pbuf_dp, value, _bool=False,
error_prefix='Invalid value') | python | {
"resource": ""
} |
q12462 | Computation.stream | train | def stream(self):
"""Iterate over the messages from the computation's output.
Control and metadata messages are intercepted and interpreted to
enhance this Computation's object knowledge of the computation's
context. Data and event messages are yielded back to the caller as a
ge... | python | {
"resource": ""
} |
q12463 | Computation._process_info_message | train | def _process_info_message(self, message):
"""Process an information message received from the computation."""
# Extract the output resolution from the appropriate message, if
# it's present.
if message['messageCode'] == 'JOB_RUNNING_RESOLUTION':
self._resolution = message['co... | python | {
"resource": ""
} |
q12464 | SignalFlowClient.execute | train | def execute(self, program, start=None, stop=None, resolution=None,
max_delay=None, persistent=False, immediate=False,
disable_all_metric_publishes=None):
"""Execute the given SignalFlow program and stream the output back."""
params = self._get_params(start=start, stop=sto... | python | {
"resource": ""
} |
q12465 | SignalFlowClient.preflight | train | def preflight(self, program, start, stop, resolution=None,
max_delay=None):
"""Preflight the given SignalFlow program and stream the output
back."""
params = self._get_params(start=start, stop=stop,
resolution=resolution,
... | python | {
"resource": ""
} |
q12466 | SignalFlowClient.start | train | def start(self, program, start=None, stop=None, resolution=None,
max_delay=None):
"""Start executing the given SignalFlow program without being attached
to the output of the computation."""
params = self._get_params(start=start, stop=stop,
resoluti... | python | {
"resource": ""
} |
q12467 | SignalFlowClient.attach | train | def attach(self, handle, filters=None, resolution=None):
"""Attach to an existing SignalFlow computation."""
params = self._get_params(filters=filters, resolution=resolution)
c = computation.Computation(
lambda since: self._transport.attach(handle, params))
self._computations... | python | {
"resource": ""
} |
q12468 | SignalFlowClient.stop | train | def stop(self, handle, reason=None):
"""Stop a SignalFlow computation."""
params = self._get_params(reason=reason)
self._transport.stop(handle, params) | python | {
"resource": ""
} |
q12469 | SignalFxRestClient.get_metric_by_name | train | def get_metric_by_name(self, metric_name, **kwargs):
"""
get a metric by name
Args:
metric_name (string): name of metric
Returns:
dictionary of response
"""
return self._get_object_by_name(self._METRIC_ENDPOINT_SUFFIX,
... | python | {
"resource": ""
} |
q12470 | SignalFxRestClient.update_metric_by_name | train | def update_metric_by_name(self, metric_name, metric_type, description=None,
custom_properties=None, tags=None, **kwargs):
"""
Create or update a metric object
Args:
metric_name (string): name of metric
type (string): metric type, must be one... | python | {
"resource": ""
} |
q12471 | SignalFxRestClient.get_dimension | train | def get_dimension(self, key, value, **kwargs):
"""
get a dimension by key and value
Args:
key (string): key of the dimension
value (string): value of the dimension
Returns:
dictionary of response
"""
return self._get_object_by_name(se... | python | {
"resource": ""
} |
q12472 | SignalFxRestClient.get_metric_time_series | train | def get_metric_time_series(self, mts_id, **kwargs):
"""get a metric time series by id"""
return self._get_object_by_name(self._MTS_ENDPOINT_SUFFIX,
mts_id,
**kwargs) | python | {
"resource": ""
} |
q12473 | SignalFxRestClient.get_tag | train | def get_tag(self, tag_name, **kwargs):
"""get a tag by name
Args:
tag_name (string): name of tag to get
Returns:
dictionary of the response
"""
return self._get_object_by_name(self._TAG_ENDPOINT_SUFFIX,
tag_name,
... | python | {
"resource": ""
} |
q12474 | SignalFxRestClient.update_tag | train | def update_tag(self, tag_name, description=None,
custom_properties=None, **kwargs):
"""update a tag by name
Args:
tag_name (string): name of tag to update
description (optional[string]): a description
custom_properties (optional[dict]): dictionary ... | python | {
"resource": ""
} |
q12475 | SignalFxRestClient.delete_tag | train | def delete_tag(self, tag_name, **kwargs):
"""delete a tag by name
Args:
tag_name (string): name of tag to delete
"""
resp = self._delete(self._u(self._TAG_ENDPOINT_SUFFIX, tag_name),
**kwargs)
resp.raise_for_status()
# successful d... | python | {
"resource": ""
} |
q12476 | SignalFxRestClient.get_organization | train | def get_organization(self, **kwargs):
"""Get the organization to which the user belongs
Returns:
dictionary of the response
"""
resp = self._get(self._u(self._ORGANIZATION_ENDPOINT_SUFFIX),
**kwargs)
resp.raise_for_status()
return res... | python | {
"resource": ""
} |
q12477 | SignalFxRestClient.validate_detector | train | def validate_detector(self, detector):
"""Validate a detector.
Validates the given detector; throws a 400 Bad Request HTTP error if
the detector is invalid; otherwise doesn't return or throw anything.
Args:
detector (object): the detector model object. Will be serialized as... | python | {
"resource": ""
} |
q12478 | SignalFxRestClient.create_detector | train | def create_detector(self, detector):
"""Creates a new detector.
Args:
detector (object): the detector model object. Will be serialized as
JSON.
Returns:
dictionary of the response (created detector model).
"""
resp = self._post(self._u(sel... | python | {
"resource": ""
} |
q12479 | SignalFxRestClient.update_detector | train | def update_detector(self, detector_id, detector):
"""Update an existing detector.
Args:
detector_id (string): the ID of the detector.
detector (object): the detector model object. Will be serialized as
JSON.
Returns:
dictionary of the response... | python | {
"resource": ""
} |
q12480 | SignalFxRestClient.delete_detector | train | def delete_detector(self, detector_id, **kwargs):
"""Remove a detector.
Args:
detector_id (string): the ID of the detector.
"""
resp = self._delete(self._u(self._DETECTOR_ENDPOINT_SUFFIX,
detector_id),
**kwargs)... | python | {
"resource": ""
} |
q12481 | SignalFxRestClient.get_detector_incidents | train | def get_detector_incidents(self, id, **kwargs):
"""Gets all incidents for a detector
"""
resp = self._get(
self._u(self._DETECTOR_ENDPOINT_SUFFIX, id, 'incidents'),
None,
**kwargs
)
resp.raise_for_status()
return resp.json() | python | {
"resource": ""
} |
q12482 | SignalFxRestClient.clear_incident | train | def clear_incident(self, id, **kwargs):
"""Clear an incident.
"""
resp = self._put(
self._u(self._INCIDENT_ENDPOINT_SUFFIX, id, 'clear'),
None,
**kwargs
)
resp.raise_for_status()
return resp | python | {
"resource": ""
} |
q12483 | SignalFx.login | train | def login(self, email, password):
"""Authenticate a user with SignalFx to acquire a session token.
Note that data ingest can only be done with an organization or team API
access token, not with a user token obtained via this method.
Args:
email (string): the email login
... | python | {
"resource": ""
} |
q12484 | SignalFx.rest | train | def rest(self, token, endpoint=None, timeout=None):
"""Obtain a metadata REST API client."""
from . import rest
return rest.SignalFxRestClient(
token=token,
endpoint=endpoint or self._api_endpoint,
timeout=timeout or self._timeout) | python | {
"resource": ""
} |
q12485 | SignalFx.ingest | train | def ingest(self, token, endpoint=None, timeout=None, compress=None):
"""Obtain a datapoint and event ingest client."""
from . import ingest
if ingest.sf_pbuf:
client = ingest.ProtoBufSignalFxIngestClient
else:
_logger.warn('Protocol Buffers not installed properly;... | python | {
"resource": ""
} |
q12486 | SignalFx.signalflow | train | def signalflow(self, token, endpoint=None, timeout=None, compress=None):
"""Obtain a SignalFlow API client."""
from . import signalflow
compress = compress if compress is not None else self._compress
return signalflow.SignalFlowClient(
token=token,
endpoint=endpoi... | python | {
"resource": ""
} |
q12487 | MetricMetadata.register | train | def register(self, key, **kwargs):
"""Registers metadata for a metric and returns a composite key"""
dimensions = dict((k, str(v)) for k, v in kwargs.items())
composite_key = self._composite_name(key, dimensions)
self._metadata[composite_key] = {
'metric': key,
'd... | python | {
"resource": ""
} |
q12488 | WebSocketTransport.opened | train | def opened(self):
"""Handler called when the WebSocket connection is opened. The first
thing to do then is to authenticate ourselves."""
request = {
'type': 'authenticate',
'token': self._token,
'userAgent': '{} ws4py/{}'.format(version.user_agent,
... | python | {
"resource": ""
} |
q12489 | WebSocketTransport.closed | train | def closed(self, code, reason=None):
"""Handler called when the WebSocket is closed. Status code 1000
denotes a normal close; all others are errors."""
if code != 1000:
self._error = errors.SignalFlowException(code, reason)
_logger.info('Lost WebSocket connection with %s ... | python | {
"resource": ""
} |
q12490 | get_aws_unique_id | train | def get_aws_unique_id(timeout=DEFAULT_AWS_TIMEOUT):
"""Determine the current AWS unique ID
Args:
timeout (int): How long to wait for a response from AWS metadata IP
"""
try:
resp = requests.get(AWS_ID_URL, timeout=timeout).json()
except requests.exceptions.ConnectTimeout:
_l... | python | {
"resource": ""
} |
q12491 | fft | train | def fft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional discrete Fourier Transform.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) with the efficient Fast Fourier Transform (FFT)
algorithm [CT].
Parameters
----------
a : array_like... | python | {
"resource": ""
} |
q12492 | ifft | train | def ifft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier transform computed by `fft`. In other words,
``ifft(fft(a)) == a`` to within numerical accuracy.
For... | python | {
"resource": ""
} |
q12493 | rfft | train | def rfft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional discrete Fourier Transform for real input.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) of a real-valued array by means of an efficient algorithm
called the Fast Fourier Transform (FFT)... | python | {
"resource": ""
} |
q12494 | irfft | train | def irfft(a, n=None, axis=-1, norm=None):
"""
Compute the inverse of the n-point DFT for real input.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier Transform of real input computed by `rfft`.
In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical
... | python | {
"resource": ""
} |
q12495 | ihfft | train | def ihfft(a, n=None, axis=-1, norm=None):
"""
Compute the inverse FFT of a signal which has Hermitian symmetry.
Parameters
----------
a : array_like
Input array.
n : int, optional
Length of the inverse FFT.
Number of points along transformation axis in the input to use.
... | python | {
"resource": ""
} |
q12496 | fftn | train | def fftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional discrete Fourier Transform.
This function computes the *N*-dimensional discrete Fourier Transform over
any number of axes in an *M*-dimensional array by means of the Fast Fourier
Transform (FFT).
Parameters
----------... | python | {
"resource": ""
} |
q12497 | ifftn | train | def ifftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the N-dimensional discrete
Fourier Transform over any number of axes in an M-dimensional array by
means of the Fast Fourier Transform (FFT). In other ... | python | {
"resource": ""
} |
q12498 | fft2 | train | def fft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional discrete Fourier Transform
This function computes the *n*-dimensional discrete Fourier Transform
over any axes in an *M*-dimensional array by means of the
Fast Fourier Transform (FFT). By default, the transform is compute... | python | {
"resource": ""
} |
q12499 | ifft2 | train | def ifft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the 2-dimensional discrete Fourier
Transform over any number of axes in an M-dimensional array by means of
the Fast Fourier Transform (FFT). In ot... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.