repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
DolphDev/pynationstates | nationstates/objects.py | Nation.verify | 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 | 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) | Wraps around the verify API | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/objects.py#L224-L229 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/__init__.py | PagedIter.get_listing_from_response | def get_listing_from_response(self, resp) -> typing.Iterable[typing.Tuple[str, dict]]:
"""
Retrieve blob metadata objects from blobstore response.
Metadata objects represented as tuples in the form of:
(key, {BlobMetadataField: val, ...})
"""
raise NotImplementedError() | python | def get_listing_from_response(self, resp) -> typing.Iterable[typing.Tuple[str, dict]]:
"""
Retrieve blob metadata objects from blobstore response.
Metadata objects represented as tuples in the form of:
(key, {BlobMetadataField: val, ...})
"""
raise NotImplementedError() | Retrieve blob metadata objects from blobstore response.
Metadata objects represented as tuples in the form of:
(key, {BlobMetadataField: val, ...}) | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/__init__.py#L33-L39 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/__init__.py | BlobStore.list | def list(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
) -> typing.Iterator[str]:
"""
Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the prefix... | python | def list(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
) -> typing.Iterator[str]:
"""
Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the prefix... | Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the prefix. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/__init__.py#L93-L103 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/__init__.py | BlobStore.list_v2 | def list_v2(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
start_after_key: str=None,
token: str=None,
k_page_max: int=None,
) -> typing.Iterable[typing.Tuple[str, dict]]:
"""
Returns an iterator of all b... | python | def list_v2(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
start_after_key: str=None,
token: str=None,
k_page_max: int=None,
) -> typing.Iterable[typing.Tuple[str, dict]]:
"""
Returns an iterator of all b... | Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the prefix. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/__init__.py#L105-L118 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/__init__.py | BlobStore.upload_file_handle | 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 | 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.
"""
... | Saves the contents of a file handle as the contents of an object in a bucket. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/__init__.py#L134-L144 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/__init__.py | BlobStore.get_copy_token | def get_copy_token(
self,
bucket: str,
key: str,
cloud_checksum: str,
) -> typing.Any:
"""
Given a bucket, key, and the expected cloud-provided checksum, retrieve a token that can be passed into
:func:`~cloud_blobstore.BlobStore.copy` that guar... | python | def get_copy_token(
self,
bucket: str,
key: str,
cloud_checksum: str,
) -> typing.Any:
"""
Given a bucket, key, and the expected cloud-provided checksum, retrieve a token that can be passed into
:func:`~cloud_blobstore.BlobStore.copy` that guar... | Given a bucket, key, and the expected cloud-provided checksum, retrieve a token that can be passed into
:func:`~cloud_blobstore.BlobStore.copy` that guarantees the copy refers to the same version of the blob
identified by the checksum.
:param bucket: the bucket the object resides in.
:pa... | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/__init__.py#L189-L204 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/__init__.py | BlobStore.get_user_metadata | def get_user_metadata(
self,
bucket: str,
key: str
) -> typing.Dict[str, str]:
"""
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped befo... | python | def get_user_metadata(
self,
bucket: str,
key: str
) -> typing.Dict[str, str]:
"""
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped befo... | Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped before being returned.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is... | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/__init__.py#L232-L245 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.list | def list(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
) -> typing.Iterator[str]:
"""
Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the prefix... | python | def list(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
) -> typing.Iterator[str]:
"""
Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the prefix... | Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the prefix. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L115-L134 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get | def get(self, bucket: str, key: str) -> bytes:
"""
Retrieves the data for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being
retrieved.
:return: the data
"""
try:... | python | def get(self, bucket: str, key: str) -> bytes:
"""
Retrieves the data for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being
retrieved.
:return: the data
"""
try:... | Retrieves the data for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being
retrieved.
:return: the data | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L206-L223 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_all_metadata | def get_all_metadata(
self,
bucket: str,
key: str
) -> dict:
"""
Retrieves all the metadata for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being retriev... | python | def get_all_metadata(
self,
bucket: str,
key: str
) -> dict:
"""
Retrieves all the metadata for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being retriev... | Retrieves all the metadata for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being retrieved.
:return: the metadata | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L226-L246 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_content_type | def get_content_type(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the content-type for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which content-type is being retr... | python | def get_content_type(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the content-type for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which content-type is being retr... | Retrieves the content-type for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which content-type is being retrieved.
:return: the content-type | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L248-L261 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_cloud_checksum | def get_cloud_checksum(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the cloud-provided checksum for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which checksum is b... | python | def get_cloud_checksum(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the cloud-provided checksum for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which checksum is b... | Retrieves the cloud-provided checksum for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which checksum is being retrieved.
:return: the cloud-provided checksum | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L280-L292 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_creation_date | def get_creation_date(
self,
bucket: str,
key: str,
) -> datetime:
"""
Retrieves the creation date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the creation date is ... | python | def get_creation_date(
self,
bucket: str,
key: str,
) -> datetime:
"""
Retrieves the creation date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the creation date is ... | Retrieves the creation date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the creation date is being retrieved.
:return: the creation date | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L295-L308 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_last_modified_date | def get_last_modified_date(
self,
bucket: str,
key: str,
) -> datetime:
"""
Retrieves last modified date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the last modifi... | python | def get_last_modified_date(
self,
bucket: str,
key: str,
) -> datetime:
"""
Retrieves last modified date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the last modifi... | Retrieves last modified date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the last modified date is being retrieved.
:return: the last modified date | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L311-L323 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_user_metadata | def get_user_metadata(
self,
bucket: str,
key: str
) -> typing.Dict[str, str]:
"""
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped befo... | python | def get_user_metadata(
self,
bucket: str,
key: str
) -> typing.Dict[str, str]:
"""
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped befo... | Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped before being returned.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is... | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L326-L356 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_size | def get_size(
self,
bucket: str,
key: str
) -> int:
"""
Retrieves the filesize
:param bucket: the bucket the object resides in.
:param key: the key of the object for which size is being retrieved.
:return: integer equal to filesize in bytes... | python | def get_size(
self,
bucket: str,
key: str
) -> int:
"""
Retrieves the filesize
:param bucket: the bucket the object resides in.
:param key: the key of the object for which size is being retrieved.
:return: integer equal to filesize in bytes... | Retrieves the filesize
:param bucket: the bucket the object resides in.
:param key: the key of the object for which size is being retrieved.
:return: integer equal to filesize in bytes | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L387-L405 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.find_next_missing_parts | 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 | 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 ... | Given a `bucket`, `key`, and `upload_id`, find the next N missing parts of a multipart upload, where
N=`return_count`. If `search_start` is provided, start the search at part M, where M=`search_start`.
`part_count` is the number of parts expected for the upload.
Note that the return value may ... | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L407-L451 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.check_bucket_exists | def check_bucket_exists(self, bucket: str) -> bool:
"""
Checks if bucket with specified name exists.
:param bucket: the bucket to be checked.
:return: true if specified bucket exists.
"""
exists = True
try:
self.s3_client.head_bucket(Bucket=bucket)
... | python | def check_bucket_exists(self, bucket: str) -> bool:
"""
Checks if bucket with specified name exists.
:param bucket: the bucket to be checked.
:return: true if specified bucket exists.
"""
exists = True
try:
self.s3_client.head_bucket(Bucket=bucket)
... | Checks if bucket with specified name exists.
:param bucket: the bucket to be checked.
:return: true if specified bucket exists. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L454-L469 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/s3.py | S3BlobStore.get_bucket_region | def get_bucket_region(self, bucket) -> str:
"""
Get region associated with a specified bucket name.
:param bucket: the bucket to be checked.
:return: region, Note that underlying AWS API returns None for default US-East-1,
I'm replacing that with us-east-1.
"""
re... | python | def get_bucket_region(self, bucket) -> str:
"""
Get region associated with a specified bucket name.
:param bucket: the bucket to be checked.
:return: region, Note that underlying AWS API returns None for default US-East-1,
I'm replacing that with us-east-1.
"""
re... | Get region associated with a specified bucket name.
:param bucket: the bucket to be checked.
:return: region, Note that underlying AWS API returns None for default US-East-1,
I'm replacing that with us-east-1. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L472-L480 |
joshburnett/scanf | setup.py | get_version | def get_version(filename='scanf.py'):
""" Extract version information from source code """
version = ''
with open(filename, 'r') as fp:
for line in fp:
m = re.search('__version__ .* ''(.*)''', line)
if m is not None:
version = (m.group(1)).strip('\'')
... | python | def get_version(filename='scanf.py'):
""" Extract version information from source code """
version = ''
with open(filename, 'r') as fp:
for line in fp:
m = re.search('__version__ .* ''(.*)''', line)
if m is not None:
version = (m.group(1)).strip('\'')
... | Extract version information from source code | https://github.com/joshburnett/scanf/blob/52f8911581c1590a3dcc6f17594eeb7b39716d42/setup.py#L8-L17 |
joshburnett/scanf | scanf.py | scanf_compile | 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 | 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 ... | 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 for faster reuse | https://github.com/joshburnett/scanf/blob/52f8911581c1590a3dcc6f17594eeb7b39716d42/scanf.py#L76-L118 |
joshburnett/scanf | scanf.py | scanf | def scanf(format, s=None, collapseWhitespace=True):
"""
scanf supports the following formats:
%c One character
%5c 5 characters
%d, %i int value
%7d, %7i int value with length 7
%f float value
%o octal value
%X, %x hex value
%s ... | python | def scanf(format, s=None, collapseWhitespace=True):
"""
scanf supports the following formats:
%c One character
%5c 5 characters
%d, %i int value
%7d, %7i int value with length 7
%f float value
%o octal value
%X, %x hex value
%s ... | scanf supports the following formats:
%c One character
%5c 5 characters
%d, %i int value
%7d, %7i int value with length 7
%f float value
%o octal value
%X, %x hex value
%s string terminated by whitespace
Examples:
>>> scan... | https://github.com/joshburnett/scanf/blob/52f8911581c1590a3dcc6f17594eeb7b39716d42/scanf.py#L121-L155 |
joshburnett/scanf | scanf.py | extractdata | 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 | 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... | 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, the file at *filepath* will be opened and parsed. | https://github.com/joshburnett/scanf/blob/52f8911581c1590a3dcc6f17594eeb7b39716d42/scanf.py#L158-L184 |
DolphDev/pynationstates | nationstates/main.py | Nationstates.nation | 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 | 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
... | 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
:type nation_name: str
:type password: str
:typ... | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/main.py#L22-L34 |
DolphDev/pynationstates | nationstates/main.py | Nationstates.wa | 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 | 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 ... | 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 | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/main.py#L56-L67 |
DolphDev/pynationstates | nationstates/main.py | Nationstates.telegram | def telegram(self, client_key=None, tgid=None, key=None):
"""Create Telegram Templates which can be used to send telegrams
:param client_key: Client Key Nationstates Gave you
:param tgid: TGID from api template
:param key: Key from api Template
"""
return Tele... | python | def telegram(self, client_key=None, tgid=None, key=None):
"""Create Telegram Templates which can be used to send telegrams
:param client_key: Client Key Nationstates Gave you
:param tgid: TGID from api template
:param key: Key from api Template
"""
return Tele... | Create Telegram Templates which can be used to send telegrams
:param client_key: Client Key Nationstates Gave you
:param tgid: TGID from api template
:param key: Key from api Template | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/main.py#L69-L75 |
cscorley/whatthepatch | whatthepatch/apply.py | apply_patch | 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 | 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()
... | Not ready for use yet | https://github.com/cscorley/whatthepatch/blob/725a9831c0b5086bb8081bd538516d26206527d7/whatthepatch/apply.py#L9-L25 |
Demonware/jose | jose.py | deserialize_compact | def deserialize_compact(jwt):
""" Deserialization of a compact representation of a :class:`~jwt.JWE`
:param jwt: The serialized JWT to deserialize.
:rtype: :class:`~jose.JWT`.
:raises: :class:`~jose.Error` if the JWT is malformed
"""
parts = jwt.split('.')
if len(parts) == 3:
token... | python | def deserialize_compact(jwt):
""" Deserialization of a compact representation of a :class:`~jwt.JWE`
:param jwt: The serialized JWT to deserialize.
:rtype: :class:`~jose.JWT`.
:raises: :class:`~jose.Error` if the JWT is malformed
"""
parts = jwt.split('.')
if len(parts) == 3:
token... | Deserialization of a compact representation of a :class:`~jwt.JWE`
:param jwt: The serialized JWT to deserialize.
:rtype: :class:`~jose.JWT`.
:raises: :class:`~jose.Error` if the JWT is malformed | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L98-L114 |
Demonware/jose | jose.py | encrypt | def encrypt(claims, jwk, adata='', add_header=None, alg='RSA-OAEP',
enc='A128CBC-HS256', rng=get_random_bytes, compression=None):
""" Encrypts the given claims and produces a :class:`~jose.JWE`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWE`.
:param jw... | python | def encrypt(claims, jwk, adata='', add_header=None, alg='RSA-OAEP',
enc='A128CBC-HS256', rng=get_random_bytes, compression=None):
""" Encrypts the given claims and produces a :class:`~jose.JWE`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWE`.
:param jw... | Encrypts the given claims and produces a :class:`~jose.JWE`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWE`.
:param jwk: A `dict` representing the JWK to be used for encryption of
the CEK. This parameter is algorithm-specific.
:param adata: Arb... | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L182-L249 |
Demonware/jose | jose.py | spec_compliant_encrypt | def spec_compliant_encrypt(claims, jwk, add_header=None, alg='RSA-OAEP',
enc='A128CBC-HS256', rng=get_random_bytes):
""" Encrypts the given claims and produces a :class:`~jose.JWE`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWE`.
:pa... | python | def spec_compliant_encrypt(claims, jwk, add_header=None, alg='RSA-OAEP',
enc='A128CBC-HS256', rng=get_random_bytes):
""" Encrypts the given claims and produces a :class:`~jose.JWE`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWE`.
:pa... | Encrypts the given claims and produces a :class:`~jose.JWE`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWE`.
:param jwk: A `dict` representing the JWK to be used for encryption of
the CEK. This parameter is algorithm-specific.
:param add_header... | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L252-L312 |
Demonware/jose | jose.py | legacy_decrypt | def legacy_decrypt(jwe, jwk, adata='', validate_claims=True,
expiry_seconds=None):
""" Decrypts a deserialized :class:`~jose.JWE`
:param jwe: An instance of :class:`~jose.JWE`
:param jwk: A `dict` representing the JWK required to decrypt the content
of the :class:`~jose.J... | python | def legacy_decrypt(jwe, jwk, adata='', validate_claims=True,
expiry_seconds=None):
""" Decrypts a deserialized :class:`~jose.JWE`
:param jwe: An instance of :class:`~jose.JWE`
:param jwk: A `dict` representing the JWK required to decrypt the content
of the :class:`~jose.J... | Decrypts a deserialized :class:`~jose.JWE`
:param jwe: An instance of :class:`~jose.JWE`
:param jwk: A `dict` representing the JWK required to decrypt the content
of the :class:`~jose.JWE`.
:param adata: Arbitrary string data used during encryption for additional
authentic... | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L315-L380 |
Demonware/jose | jose.py | spec_compliant_decrypt | def spec_compliant_decrypt(jwe, jwk, validate_claims=True,
expiry_seconds=None):
""" Decrypts a deserialized :class:`~jose.JWE`
:param jwe: An instance of :class:`~jose.JWE`
:param jwk: A `dict` representing the JWK required to decrypt the content
of the :class:`~... | python | def spec_compliant_decrypt(jwe, jwk, validate_claims=True,
expiry_seconds=None):
""" Decrypts a deserialized :class:`~jose.JWE`
:param jwe: An instance of :class:`~jose.JWE`
:param jwk: A `dict` representing the JWK required to decrypt the content
of the :class:`~... | Decrypts a deserialized :class:`~jose.JWE`
:param jwe: An instance of :class:`~jose.JWE`
:param jwk: A `dict` representing the JWK required to decrypt the content
of the :class:`~jose.JWE`.
:param validate_claims: A `bool` indicating whether or not the `exp`, `iat`
... | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L383-L440 |
Demonware/jose | jose.py | decrypt | def decrypt(*args, **kwargs):
""" Decrypts legacy or spec-compliant JOSE token.
First attempts to decrypt the token in a legacy mode
(https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-19).
If it is not a valid legacy token then attempts to decrypt it in a
spec-compliant way (http://tools.i... | python | def decrypt(*args, **kwargs):
""" Decrypts legacy or spec-compliant JOSE token.
First attempts to decrypt the token in a legacy mode
(https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-19).
If it is not a valid legacy token then attempts to decrypt it in a
spec-compliant way (http://tools.i... | Decrypts legacy or spec-compliant JOSE token.
First attempts to decrypt the token in a legacy mode
(https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-19).
If it is not a valid legacy token then attempts to decrypt it in a
spec-compliant way (http://tools.ietf.org/html/rfc7519) | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L443-L458 |
Demonware/jose | jose.py | sign | def sign(claims, jwk, add_header=None, alg='HS256'):
""" Signs the given claims and produces a :class:`~jose.JWS`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWS`.
:param jwk: A `dict` representing the JWK to be used for signing of the
:class:`~... | python | def sign(claims, jwk, add_header=None, alg='HS256'):
""" Signs the given claims and produces a :class:`~jose.JWS`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWS`.
:param jwk: A `dict` representing the JWK to be used for signing of the
:class:`~... | Signs the given claims and produces a :class:`~jose.JWS`
:param claims: A `dict` representing the claims for this
:class:`~jose.JWS`.
:param jwk: A `dict` representing the JWK to be used for signing of the
:class:`~jose.JWS`. This parameter is algorithm-specific.
:paramet... | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L461-L481 |
Demonware/jose | jose.py | verify | def verify(jws, jwk, alg, validate_claims=True, expiry_seconds=None):
""" Verifies the given :class:`~jose.JWS`
:param jws: The :class:`~jose.JWS` to be verified.
:param jwk: A `dict` representing the JWK to use for verification. This
parameter is algorithm-specific.
:param alg: The alg... | python | def verify(jws, jwk, alg, validate_claims=True, expiry_seconds=None):
""" Verifies the given :class:`~jose.JWS`
:param jws: The :class:`~jose.JWS` to be verified.
:param jwk: A `dict` representing the JWK to use for verification. This
parameter is algorithm-specific.
:param alg: The alg... | Verifies the given :class:`~jose.JWS`
:param jws: The :class:`~jose.JWS` to be verified.
:param jwk: A `dict` representing the JWK to use for verification. This
parameter is algorithm-specific.
:param alg: The algorithm to verify the signature with.
:param validate_claims: A `bool` indi... | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L484-L516 |
Demonware/jose | jose.py | b64decode_url | 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 | 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... | JWT Tokens may be truncated without the usual trailing padding '='
symbols. Compensate by padding to the nearest 4 bytes. | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L519-L527 |
Demonware/jose | jose.py | _validate | 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 | 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... | 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. | https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L705-L752 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | gauge | 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 | 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) | Adds gauge with dimensions to the global pyformance registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L127-L129 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | count_calls_with_dims | 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 | 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... | Decorator to track the number of times a function is called
with with dimensions. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L132-L143 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | meter_calls_with_dims | 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 | 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)... | Decorator to track the rate at which a function is called
with dimensions. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L146-L157 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | hist_calls | 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 | 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 ... | Decorator to check the distribution of return values of a function. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L162-L174 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | hist_calls_with_dims | 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 | 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... | Decorator to check the distribution of return values of a
function with dimensions. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L177-L191 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | time_calls_with_dims | 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 | 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)
... | Decorator to time the execution of the function with dimensions. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L194-L204 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | MetricsRegistry.add | 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 | 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) | Adds custom metric instances to the registry with dimensions
which are not created with their constructors default arguments | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L21-L26 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | MetricsRegistry.counter | def counter(self, key, **dims):
"""Adds counter with dimensions to the registry"""
return super(MetricsRegistry, self).counter(
self.metadata.register(key, **dims)) | python | def counter(self, key, **dims):
"""Adds counter with dimensions to the registry"""
return super(MetricsRegistry, self).counter(
self.metadata.register(key, **dims)) | Adds counter with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L28-L31 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | MetricsRegistry.histogram | def histogram(self, key, **dims):
"""Adds histogram with dimensions to the registry"""
return super(MetricsRegistry, self).histogram(
self.metadata.register(key, **dims)) | python | def histogram(self, key, **dims):
"""Adds histogram with dimensions to the registry"""
return super(MetricsRegistry, self).histogram(
self.metadata.register(key, **dims)) | Adds histogram with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L33-L36 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | MetricsRegistry.gauge | def gauge(self, key, gauge=None, default=float("nan"), **dims):
"""Adds gauge with dimensions to the registry"""
return super(MetricsRegistry, self).gauge(
self.metadata.register(key, **dims), gauge=gauge, default=default) | python | def gauge(self, key, gauge=None, default=float("nan"), **dims):
"""Adds gauge with dimensions to the registry"""
return super(MetricsRegistry, self).gauge(
self.metadata.register(key, **dims), gauge=gauge, default=default) | Adds gauge with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L38-L41 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | MetricsRegistry.meter | def meter(self, key, **dims):
"""Adds meter with dimensions to the registry"""
return super(MetricsRegistry, self).meter(
self.metadata.register(key, **dims)) | python | def meter(self, key, **dims):
"""Adds meter with dimensions to the registry"""
return super(MetricsRegistry, self).meter(
self.metadata.register(key, **dims)) | Adds meter with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L43-L46 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | MetricsRegistry.timer | def timer(self, key, **dims):
"""Adds timer with dimensions to the registry"""
return super(MetricsRegistry, self).timer(
self.metadata.register(key, **dims)) | python | def timer(self, key, **dims):
"""Adds timer with dimensions to the registry"""
return super(MetricsRegistry, self).timer(
self.metadata.register(key, **dims)) | Adds timer with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L48-L51 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | RegexRegistry.timer | def timer(self, key, **dims):
"""Adds timer with dimensions to the registry"""
return super(RegexRegistry, self).timer(self._get_key(key), **dims) | python | def timer(self, key, **dims):
"""Adds timer with dimensions to the registry"""
return super(RegexRegistry, self).timer(self._get_key(key), **dims) | Adds timer with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L85-L87 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | RegexRegistry.histogram | def histogram(self, key, **dims):
"""Adds histogram with dimensions to the registry"""
return super(RegexRegistry, self).histogram(self._get_key(key), **dims) | python | def histogram(self, key, **dims):
"""Adds histogram with dimensions to the registry"""
return super(RegexRegistry, self).histogram(self._get_key(key), **dims) | Adds histogram with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L89-L91 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | RegexRegistry.counter | def counter(self, key, **dims):
"""Adds counter with dimensions to the registry"""
return super(RegexRegistry, self).counter(self._get_key(key), **dims) | python | def counter(self, key, **dims):
"""Adds counter with dimensions to the registry"""
return super(RegexRegistry, self).counter(self._get_key(key), **dims) | Adds counter with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L93-L95 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | RegexRegistry.gauge | def gauge(self, key, gauge=None, default=float("nan"), **dims):
"""Adds gauge with dimensions to the registry"""
return super(RegexRegistry, self).gauge(
self._get_key(key), gauge=gauge, default=default, **dims) | python | def gauge(self, key, gauge=None, default=float("nan"), **dims):
"""Adds gauge with dimensions to the registry"""
return super(RegexRegistry, self).gauge(
self._get_key(key), gauge=gauge, default=default, **dims) | Adds gauge with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L97-L100 |
signalfx/signalfx-python | signalfx/pyformance/registry.py | RegexRegistry.meter | def meter(self, key, **dims):
"""Adds meter with dimensions to the registry"""
return super(RegexRegistry, self).meter(self._get_key(key), **dims) | python | def meter(self, key, **dims):
"""Adds meter with dimensions to the registry"""
return super(RegexRegistry, self).meter(self._get_key(key), **dims) | Adds meter with dimensions to the registry | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/registry.py#L102-L104 |
signalfx/signalfx-python | signalfx/ingest.py | _BaseSignalFxIngestClient.remove_dimensions | def remove_dimensions(self, dimension_names):
"""Removes extra dimensions added by the add_dimensions() function.
Ignores dimension names that don't exist.
Args:
dimension_names (list): List of dimension names to remove.
"""
with self._lock:
for dimension... | python | def remove_dimensions(self, dimension_names):
"""Removes extra dimensions added by the add_dimensions() function.
Ignores dimension names that don't exist.
Args:
dimension_names (list): List of dimension names to remove.
"""
with self._lock:
for dimension... | Removes extra dimensions added by the add_dimensions() function.
Ignores dimension names that don't exist.
Args:
dimension_names (list): List of dimension names to remove. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/ingest.py#L106-L116 |
signalfx/signalfx-python | signalfx/ingest.py | _BaseSignalFxIngestClient.send | 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 | 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... | 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 representing the gauges to
report.
counters (list): a list of di... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/ingest.py#L118-L149 |
signalfx/signalfx-python | signalfx/ingest.py | _BaseSignalFxIngestClient.send_event | 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 | 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... | Send an event to SignalFx.
Args:
event_type (string): the event type (name of the event time
series).
category (string): the category of the event.
dimensions (dict): a map of event dimensions.
properties (dict): a map of extra properties on that ... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/ingest.py#L151-L180 |
signalfx/signalfx-python | signalfx/ingest.py | _BaseSignalFxIngestClient.stop | 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 | 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... | Stop send thread and flush points for a safe exit. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/ingest.py#L199-L207 |
signalfx/signalfx-python | signalfx/ingest.py | ProtoBufSignalFxIngestClient._assign_value_by_type | 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 | 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... | Assigns the supplied value to the appropriate protobuf value type | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/ingest.py#L301-L324 |
signalfx/signalfx-python | signalfx/ingest.py | ProtoBufSignalFxIngestClient._assign_value | 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 | 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') | Assigns a value to the protobuf obj | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/ingest.py#L331-L334 |
signalfx/signalfx-python | signalfx/signalflow/computation.py | Computation.stream | 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 | 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... | 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
generator. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/computation.py#L76-L169 |
signalfx/signalfx-python | signalfx/signalflow/computation.py | Computation._process_info_message | 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 | 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... | Process an information message received from the computation. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/computation.py#L171-L178 |
signalfx/signalfx-python | signalfx/signalflow/__init__.py | SignalFlowClient.execute | 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 | 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... | Execute the given SignalFlow program and stream the output back. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/__init__.py#L33-L51 |
signalfx/signalfx-python | signalfx/signalflow/__init__.py | SignalFlowClient.preflight | 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 | 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,
... | Preflight the given SignalFlow program and stream the output
back. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/__init__.py#L53-L68 |
signalfx/signalfx-python | signalfx/signalflow/__init__.py | SignalFlowClient.start | 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 | 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... | Start executing the given SignalFlow program without being attached
to the output of the computation. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/__init__.py#L70-L77 |
signalfx/signalfx-python | signalfx/signalflow/__init__.py | SignalFlowClient.attach | 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 | 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... | Attach to an existing SignalFlow computation. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/__init__.py#L79-L85 |
signalfx/signalfx-python | signalfx/signalflow/__init__.py | SignalFlowClient.stop | def stop(self, handle, reason=None):
"""Stop a SignalFlow computation."""
params = self._get_params(reason=reason)
self._transport.stop(handle, params) | python | def stop(self, handle, reason=None):
"""Stop a SignalFlow computation."""
params = self._get_params(reason=reason)
self._transport.stop(handle, params) | Stop a SignalFlow computation. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/signalflow/__init__.py#L91-L94 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient._search_metrics_and_metadata | def _search_metrics_and_metadata(self, metadata_endpoint, query,
order_by=None, offset=None,
limit=None, timeout=None):
"""
generic function for elasticsearch queries; can search metrics,
dimensions, metrictimeseries b... | python | def _search_metrics_and_metadata(self, metadata_endpoint, query,
order_by=None, offset=None,
limit=None, timeout=None):
"""
generic function for elasticsearch queries; can search metrics,
dimensions, metrictimeseries b... | generic function for elasticsearch queries; can search metrics,
dimensions, metrictimeseries by changing metadata_endpoint
Args:
metadata_endpoint (string): API endpoint suffix (e.g. 'v2/metric')
query (string): elasticsearch string query
order_by (optional[string... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L95-L126 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient._get_object_by_name | def _get_object_by_name(self, object_endpoint, object_name, timeout=None):
"""
generic function to get object (metadata, tag, ) by name from SignalFx.
Args:
object_endpoint (string): API endpoint suffix (e.g. 'v2/tag')
object_name (string): name of the object (e.g. 'jvm.... | python | def _get_object_by_name(self, object_endpoint, object_name, timeout=None):
"""
generic function to get object (metadata, tag, ) by name from SignalFx.
Args:
object_endpoint (string): API endpoint suffix (e.g. 'v2/tag')
object_name (string): name of the object (e.g. 'jvm.... | generic function to get object (metadata, tag, ) by name from SignalFx.
Args:
object_endpoint (string): API endpoint suffix (e.g. 'v2/tag')
object_name (string): name of the object (e.g. 'jvm.cpu.load')
Returns:
dictionary of response | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L128-L143 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.search_metrics | def search_metrics(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
lim... | python | def search_metrics(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
lim... | Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
limit (optional[int]): how many results to return (default=50)
... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L146-L160 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_metric_by_name | 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 | 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,
... | get a metric by name
Args:
metric_name (string): name of metric
Returns:
dictionary of response | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L162-L174 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.update_metric_by_name | 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 | 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... | Create or update a metric object
Args:
metric_name (string): name of metric
type (string): metric type, must be one of 'gauge', 'counter',
'cumulative_counter'
description (optional[string]): a description
custom_properties (optional[d... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L176-L198 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.search_dimensions | def search_dimensions(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
... | python | def search_dimensions(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
... | Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
limit (optional[int]): how many results to return (default=50)
... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L201-L215 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_dimension | 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 | 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... | get a dimension by key and value
Args:
key (string): key of the dimension
value (string): value of the dimension
Returns:
dictionary of response | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L217-L230 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.update_dimension | def update_dimension(self, key, value, description=None,
custom_properties=None, tags=None, **kwargs):
"""
update a dimension
Args:
key (string): key of the dimension
value (string): value of the dimension
description (optional[string]... | python | def update_dimension(self, key, value, description=None,
custom_properties=None, tags=None, **kwargs):
"""
update a dimension
Args:
key (string): key of the dimension
value (string): value of the dimension
description (optional[string]... | update a dimension
Args:
key (string): key of the dimension
value (string): value of the dimension
description (optional[string]): a description
custom_properties (optional[dict]): dictionary of custom properties
tags (optional[list of strings]): list ... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L232-L252 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.search_metric_time_series | def search_metric_time_series(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
... | python | def search_metric_time_series(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
... | Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
limit (optional[int]): how many results to return (default=50)
... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L255-L270 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_metric_time_series | 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 | 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) | get a metric time series by id | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L272-L276 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.search_tags | def search_tags(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
limit ... | python | def search_tags(self, *args, **kwargs):
"""
Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
limit ... | Args:
query (string): elasticsearch string query
order_by (optional[string]): property by which to order results
offset (optional[int]): number of results to skip for pagination
(default=0)
limit (optional[int]): how many results to return (default=50)
... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L279-L294 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_tag | 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 | 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,
... | get a tag by name
Args:
tag_name (string): name of tag to get
Returns:
dictionary of the response | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L296-L308 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.update_tag | 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 | 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 ... | update a tag by name
Args:
tag_name (string): name of tag to update
description (optional[string]): a description
custom_properties (optional[dict]): dictionary of custom properties | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L310-L324 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.delete_tag | 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 | 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... | delete a tag by name
Args:
tag_name (string): name of tag to delete | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L326-L336 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_organization | 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 | 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... | Get the organization to which the user belongs
Returns:
dictionary of the response | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L339-L348 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_chart | def get_chart(self, id, **kwargs):
""""Retrieve a (v2) chart by id.
"""
resp = self._get_object_by_name(self._CHART_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | python | def get_chart(self, id, **kwargs):
""""Retrieve a (v2) chart by id.
"""
resp = self._get_object_by_name(self._CHART_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | Retrieve a (v2) chart by id. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L351-L356 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_dashboard | def get_dashboard(self, id, **kwargs):
""""Retrieve a (v2) dashboard by id.
"""
resp = self._get_object_by_name(self._DASHBOARD_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | python | def get_dashboard(self, id, **kwargs):
""""Retrieve a (v2) dashboard by id.
"""
resp = self._get_object_by_name(self._DASHBOARD_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | Retrieve a (v2) dashboard by id. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L359-L364 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_detector | def get_detector(self, id, **kwargs):
""""Retrieve a (v2) detector by id.
"""
resp = self._get_object_by_name(self._DETECTOR_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | python | def get_detector(self, id, **kwargs):
""""Retrieve a (v2) detector by id.
"""
resp = self._get_object_by_name(self._DETECTOR_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | Retrieve a (v2) detector by id. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L367-L372 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_detectors | def get_detectors(self, name=None, tags=None, batch_size=100, **kwargs):
"""Retrieve all (v2) detectors matching the given name; all (v2)
detectors otherwise.
Note that this method will loop through the paging of the results and
accumulate all detectors that match the query. This may be... | python | def get_detectors(self, name=None, tags=None, batch_size=100, **kwargs):
"""Retrieve all (v2) detectors matching the given name; all (v2)
detectors otherwise.
Note that this method will loop through the paging of the results and
accumulate all detectors that match the query. This may be... | Retrieve all (v2) detectors matching the given name; all (v2)
detectors otherwise.
Note that this method will loop through the paging of the results and
accumulate all detectors that match the query. This may be expensive. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L374-L399 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.validate_detector | 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 | 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... | 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
JSON. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L401-L413 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.create_detector | 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 | 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... | Creates a new detector.
Args:
detector (object): the detector model object. Will be serialized as
JSON.
Returns:
dictionary of the response (created detector model). | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L415-L427 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.update_detector | 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 | 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... | 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 (updated detector model). | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L429-L442 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.delete_detector | 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 | 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)... | Remove a detector.
Args:
detector_id (string): the ID of the detector. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L444-L455 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_detector_incidents | 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 | 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() | Gets all incidents for a detector | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L457-L466 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_incident | def get_incident(self, id, **kwargs):
""""Retrieve a (v2) incident by id.
"""
resp = self._get_object_by_name(self._INCIDENT_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | python | def get_incident(self, id, **kwargs):
""""Retrieve a (v2) incident by id.
"""
resp = self._get_object_by_name(self._INCIDENT_ENDPOINT_SUFFIX, id,
**kwargs)
return resp | Retrieve a (v2) incident by id. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L469-L474 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.get_incidents | def get_incidents(self, offset=0, limit=None, include_resolved=False, **kwargs):
"""Retrieve all (v2) incidents.
"""
resp = self._get(
self._u(self._INCIDENT_ENDPOINT_SUFFIX),
params={
'offset': offset,
'limit': limit,
'incl... | python | def get_incidents(self, offset=0, limit=None, include_resolved=False, **kwargs):
"""Retrieve all (v2) incidents.
"""
resp = self._get(
self._u(self._INCIDENT_ENDPOINT_SUFFIX),
params={
'offset': offset,
'limit': limit,
'incl... | Retrieve all (v2) incidents. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L476-L489 |
signalfx/signalfx-python | signalfx/rest.py | SignalFxRestClient.clear_incident | 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 | 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 | Clear an incident. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/rest.py#L491-L500 |
signalfx/signalfx-python | examples/signalflow/dataframe.py | get_data_frame | def get_data_frame(client, program, start, stop, resolution=None):
"""Executes the given program across the given time range (expressed in
millisecond timestamps since Epoch), and returns a Pandas DataFrame
containing the results, indexed by output timestamp.
If the program contains multiple publish() ... | python | def get_data_frame(client, program, start, stop, resolution=None):
"""Executes the given program across the given time range (expressed in
millisecond timestamps since Epoch), and returns a Pandas DataFrame
containing the results, indexed by output timestamp.
If the program contains multiple publish() ... | Executes the given program across the given time range (expressed in
millisecond timestamps since Epoch), and returns a Pandas DataFrame
containing the results, indexed by output timestamp.
If the program contains multiple publish() calls, their outputs are merged
into the returned DataFrame. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/examples/signalflow/dataframe.py#L20-L42 |
signalfx/signalfx-python | signalfx/__init__.py | SignalFx.login | 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 | 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
... | 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
password (string): the password
... | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/__init__.py#L77-L91 |
signalfx/signalfx-python | signalfx/__init__.py | SignalFx.rest | 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 | 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) | Obtain a metadata REST API client. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/__init__.py#L93-L99 |
signalfx/signalfx-python | signalfx/__init__.py | SignalFx.ingest | 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 | 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;... | Obtain a datapoint and event ingest client. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/__init__.py#L101-L115 |
signalfx/signalfx-python | signalfx/__init__.py | SignalFx.signalflow | 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 | 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... | Obtain a SignalFlow API client. | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/__init__.py#L117-L125 |
signalfx/signalfx-python | signalfx/pyformance/metadata.py | MetricMetadata.register | 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 | 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... | Registers metadata for a metric and returns a composite key | https://github.com/signalfx/signalfx-python/blob/650eb9a2b301bcc795e4e3a8c031574ade69849d/signalfx/pyformance/metadata.py#L24-L32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.