repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
edx/edx-django-utils | edx_django_utils/cache/utils.py | TieredCache.set_all_tiers | def set_all_tiers(key, value, django_cache_timeout=DEFAULT_TIMEOUT):
"""
Caches the value for the provided key in both the request cache and the
django cache.
Args:
key (string)
value (object)
django_cache_timeout (int): (Optional) Timeout used to det... | python | def set_all_tiers(key, value, django_cache_timeout=DEFAULT_TIMEOUT):
"""
Caches the value for the provided key in both the request cache and the
django cache.
Args:
key (string)
value (object)
django_cache_timeout (int): (Optional) Timeout used to det... | [
"def",
"set_all_tiers",
"(",
"key",
",",
"value",
",",
"django_cache_timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"DEFAULT_REQUEST_CACHE",
".",
"set",
"(",
"key",
",",
"value",
")",
"django_cache",
".",
"set",
"(",
"key",
",",
"value",
",",
"django_cache_timeou... | Caches the value for the provided key in both the request cache and the
django cache.
Args:
key (string)
value (object)
django_cache_timeout (int): (Optional) Timeout used to determine
if and for how long to cache in the django cache. A timeout of
... | [
"Caches",
"the",
"value",
"for",
"the",
"provided",
"key",
"in",
"both",
"the",
"request",
"cache",
"and",
"the",
"django",
"cache",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/cache/utils.py#L172-L187 |
edx/edx-django-utils | edx_django_utils/cache/utils.py | TieredCache._get_cached_response_from_django_cache | def _get_cached_response_from_django_cache(key):
"""
Retrieves a CachedResponse for the given key from the django cache.
If the request was set to force cache misses, then this will always
return a cache miss response.
Args:
key (string)
Returns:
... | python | def _get_cached_response_from_django_cache(key):
"""
Retrieves a CachedResponse for the given key from the django cache.
If the request was set to force cache misses, then this will always
return a cache miss response.
Args:
key (string)
Returns:
... | [
"def",
"_get_cached_response_from_django_cache",
"(",
"key",
")",
":",
"if",
"TieredCache",
".",
"_should_force_django_cache_miss",
"(",
")",
":",
"return",
"CachedResponse",
"(",
"is_found",
"=",
"False",
",",
"key",
"=",
"key",
",",
"value",
"=",
"None",
")",
... | Retrieves a CachedResponse for the given key from the django cache.
If the request was set to force cache misses, then this will always
return a cache miss response.
Args:
key (string)
Returns:
A CachedResponse with is_found status and value. | [
"Retrieves",
"a",
"CachedResponse",
"for",
"the",
"given",
"key",
"from",
"the",
"django",
"cache",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/cache/utils.py#L218-L237 |
edx/edx-django-utils | edx_django_utils/cache/utils.py | TieredCache._set_request_cache_if_django_cache_hit | def _set_request_cache_if_django_cache_hit(key, django_cached_response):
"""
Sets the value in the request cache if the django cached response was a hit.
Args:
key (string)
django_cached_response (CachedResponse)
"""
if django_cached_response.is_found:
... | python | def _set_request_cache_if_django_cache_hit(key, django_cached_response):
"""
Sets the value in the request cache if the django cached response was a hit.
Args:
key (string)
django_cached_response (CachedResponse)
"""
if django_cached_response.is_found:
... | [
"def",
"_set_request_cache_if_django_cache_hit",
"(",
"key",
",",
"django_cached_response",
")",
":",
"if",
"django_cached_response",
".",
"is_found",
":",
"DEFAULT_REQUEST_CACHE",
".",
"set",
"(",
"key",
",",
"django_cached_response",
".",
"value",
")"
] | Sets the value in the request cache if the django cached response was a hit.
Args:
key (string)
django_cached_response (CachedResponse) | [
"Sets",
"the",
"value",
"in",
"the",
"request",
"cache",
"if",
"the",
"django",
"cached",
"response",
"was",
"a",
"hit",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/cache/utils.py#L240-L250 |
edx/edx-django-utils | edx_django_utils/cache/utils.py | TieredCache._get_and_set_force_cache_miss | def _get_and_set_force_cache_miss(request):
"""
Gets value for request query parameter FORCE_CACHE_MISS
and sets it in the default request cache.
This functionality is only available for staff.
Example:
http://clobert.com/api/v1/resource?force_cache_miss=true
... | python | def _get_and_set_force_cache_miss(request):
"""
Gets value for request query parameter FORCE_CACHE_MISS
and sets it in the default request cache.
This functionality is only available for staff.
Example:
http://clobert.com/api/v1/resource?force_cache_miss=true
... | [
"def",
"_get_and_set_force_cache_miss",
"(",
"request",
")",
":",
"if",
"not",
"(",
"request",
".",
"user",
"and",
"request",
".",
"user",
".",
"is_active",
"and",
"request",
".",
"user",
".",
"is_staff",
")",
":",
"force_cache_miss",
"=",
"False",
"else",
... | Gets value for request query parameter FORCE_CACHE_MISS
and sets it in the default request cache.
This functionality is only available for staff.
Example:
http://clobert.com/api/v1/resource?force_cache_miss=true | [
"Gets",
"value",
"for",
"request",
"query",
"parameter",
"FORCE_CACHE_MISS",
"and",
"sets",
"it",
"in",
"the",
"default",
"request",
"cache",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/cache/utils.py#L253-L268 |
edx/edx-django-utils | edx_django_utils/cache/utils.py | TieredCache._should_force_django_cache_miss | def _should_force_django_cache_miss(cls):
"""
Returns True if the tiered cache should force a cache miss for the
django cache, and False otherwise.
"""
cached_response = DEFAULT_REQUEST_CACHE.get_cached_response(SHOULD_FORCE_CACHE_MISS_KEY)
return False if not cached_res... | python | def _should_force_django_cache_miss(cls):
"""
Returns True if the tiered cache should force a cache miss for the
django cache, and False otherwise.
"""
cached_response = DEFAULT_REQUEST_CACHE.get_cached_response(SHOULD_FORCE_CACHE_MISS_KEY)
return False if not cached_res... | [
"def",
"_should_force_django_cache_miss",
"(",
"cls",
")",
":",
"cached_response",
"=",
"DEFAULT_REQUEST_CACHE",
".",
"get_cached_response",
"(",
"SHOULD_FORCE_CACHE_MISS_KEY",
")",
"return",
"False",
"if",
"not",
"cached_response",
".",
"is_found",
"else",
"cached_respon... | Returns True if the tiered cache should force a cache miss for the
django cache, and False otherwise. | [
"Returns",
"True",
"if",
"the",
"tiered",
"cache",
"should",
"force",
"a",
"cache",
"miss",
"for",
"the",
"django",
"cache",
"and",
"False",
"otherwise",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/cache/utils.py#L271-L278 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.check_convert_string | def check_convert_string(obj, name=None,
no_leading_trailing_whitespace=True,
no_whitespace=False,
no_newline=True,
whole_word=False,
min_len=1,
m... | python | def check_convert_string(obj, name=None,
no_leading_trailing_whitespace=True,
no_whitespace=False,
no_newline=True,
whole_word=False,
min_len=1,
m... | [
"def",
"check_convert_string",
"(",
"obj",
",",
"name",
"=",
"None",
",",
"no_leading_trailing_whitespace",
"=",
"True",
",",
"no_whitespace",
"=",
"False",
",",
"no_newline",
"=",
"True",
",",
"whole_word",
"=",
"False",
",",
"min_len",
"=",
"1",
",",
"max_... | Ensures the provided object can be interpreted as a unicode string, optionally with
additional restrictions imposed. By default this means a non-zero length string
which does not begin or end in whitespace. | [
"Ensures",
"the",
"provided",
"object",
"can",
"be",
"interpreted",
"as",
"a",
"unicode",
"string",
"optionally",
"with",
"additional",
"restrictions",
"imposed",
".",
"By",
"default",
"this",
"means",
"a",
"non",
"-",
"zero",
"length",
"string",
"which",
"doe... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L66-L93 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.guid_check_convert | def guid_check_convert(guid, allow_none=False):
"""Take a GUID in the form of hex string "32" or "8-4-4-4-12".
Returns hex string "32" or raises ValueError: badly formed hexadecimal UUID string
"""
if isinstance(guid, string_types):
return ensure_unicode(UUID(guid).hex)
... | python | def guid_check_convert(guid, allow_none=False):
"""Take a GUID in the form of hex string "32" or "8-4-4-4-12".
Returns hex string "32" or raises ValueError: badly formed hexadecimal UUID string
"""
if isinstance(guid, string_types):
return ensure_unicode(UUID(guid).hex)
... | [
"def",
"guid_check_convert",
"(",
"guid",
",",
"allow_none",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"guid",
",",
"string_types",
")",
":",
"return",
"ensure_unicode",
"(",
"UUID",
"(",
"guid",
")",
".",
"hex",
")",
"elif",
"guid",
"is",
"None",... | Take a GUID in the form of hex string "32" or "8-4-4-4-12".
Returns hex string "32" or raises ValueError: badly formed hexadecimal UUID string | [
"Take",
"a",
"GUID",
"in",
"the",
"form",
"of",
"hex",
"string",
"32",
"or",
"8",
"-",
"4",
"-",
"4",
"-",
"4",
"-",
"12",
".",
"Returns",
"hex",
"string",
"32",
"or",
"raises",
"ValueError",
":",
"badly",
"formed",
"hexadecimal",
"UUID",
"string"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L104-L113 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.tags_check_convert | def tags_check_convert(cls, tags):
"""Accept one tag as string or multiple tags in list of strings.
Returns list (with tags in unicode form) or raises ValueError
"""
# single string check comes first since string is also a Sequence
if isinstance(tags, string_types):
r... | python | def tags_check_convert(cls, tags):
"""Accept one tag as string or multiple tags in list of strings.
Returns list (with tags in unicode form) or raises ValueError
"""
# single string check comes first since string is also a Sequence
if isinstance(tags, string_types):
r... | [
"def",
"tags_check_convert",
"(",
"cls",
",",
"tags",
")",
":",
"# single string check comes first since string is also a Sequence",
"if",
"isinstance",
"(",
"tags",
",",
"string_types",
")",
":",
"return",
"[",
"cls",
".",
"__tag_check_convert",
"(",
"tags",
")",
"... | Accept one tag as string or multiple tags in list of strings.
Returns list (with tags in unicode form) or raises ValueError | [
"Accept",
"one",
"tag",
"as",
"string",
"or",
"multiple",
"tags",
"in",
"list",
"of",
"strings",
".",
"Returns",
"list",
"(",
"with",
"tags",
"in",
"unicode",
"form",
")",
"or",
"raises",
"ValueError"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L129-L141 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.__valid_url | def __valid_url(cls, url):
"""Expects input to already be a valid string"""
bits = urlparse(url)
return ((bits.scheme == "http" or bits.scheme == "https") and
_PATTERN_URL_PART.match(bits.netloc) and
_PATTERN_URL_PART.match(bits.path)) | python | def __valid_url(cls, url):
"""Expects input to already be a valid string"""
bits = urlparse(url)
return ((bits.scheme == "http" or bits.scheme == "https") and
_PATTERN_URL_PART.match(bits.netloc) and
_PATTERN_URL_PART.match(bits.path)) | [
"def",
"__valid_url",
"(",
"cls",
",",
"url",
")",
":",
"bits",
"=",
"urlparse",
"(",
"url",
")",
"return",
"(",
"(",
"bits",
".",
"scheme",
"==",
"\"http\"",
"or",
"bits",
".",
"scheme",
"==",
"\"https\"",
")",
"and",
"_PATTERN_URL_PART",
".",
"match"... | Expects input to already be a valid string | [
"Expects",
"input",
"to",
"already",
"be",
"a",
"valid",
"string"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L231-L236 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.location_check | def location_check(lat, lon):
"""For use by Core client wrappers"""
if not (isinstance(lat, number_types) and -90 <= lat <= 90):
raise ValueError("Latitude: '{latitude}' invalid".format(latitude=lat))
if not (isinstance(lon, number_types) and -180 <= lon <= 180):
raise V... | python | def location_check(lat, lon):
"""For use by Core client wrappers"""
if not (isinstance(lat, number_types) and -90 <= lat <= 90):
raise ValueError("Latitude: '{latitude}' invalid".format(latitude=lat))
if not (isinstance(lon, number_types) and -180 <= lon <= 180):
raise V... | [
"def",
"location_check",
"(",
"lat",
",",
"lon",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"lat",
",",
"number_types",
")",
"and",
"-",
"90",
"<=",
"lat",
"<=",
"90",
")",
":",
"raise",
"ValueError",
"(",
"\"Latitude: '{latitude}' invalid\"",
".",
"... | For use by Core client wrappers | [
"For",
"use",
"by",
"Core",
"client",
"wrappers"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L239-L245 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.search_location_check | def search_location_check(cls, location):
"""Core.Client.request_search location parameter should be a dictionary that contains lat, lon and radius floats
"""
if not (isinstance(location, Mapping) and set(location.keys()) == _LOCATION_SEARCH_ARGS):
raise ValueError('Search location s... | python | def search_location_check(cls, location):
"""Core.Client.request_search location parameter should be a dictionary that contains lat, lon and radius floats
"""
if not (isinstance(location, Mapping) and set(location.keys()) == _LOCATION_SEARCH_ARGS):
raise ValueError('Search location s... | [
"def",
"search_location_check",
"(",
"cls",
",",
"location",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"location",
",",
"Mapping",
")",
"and",
"set",
"(",
"location",
".",
"keys",
"(",
")",
")",
"==",
"_LOCATION_SEARCH_ARGS",
")",
":",
"raise",
"Val... | Core.Client.request_search location parameter should be a dictionary that contains lat, lon and radius floats | [
"Core",
".",
"Client",
".",
"request_search",
"location",
"parameter",
"should",
"be",
"a",
"dictionary",
"that",
"contains",
"lat",
"lon",
"and",
"radius",
"floats"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L248-L257 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.__search_text_check_convert | def __search_text_check_convert(cls, text):
"""Converts and keeps only words in text deemed to be valid"""
text = cls.check_convert_string(text, name='text', no_leading_trailing_whitespace=False)
if len(text) > VALIDATION_META_SEARCH_TEXT:
raise ValueError("Search text can contain at... | python | def __search_text_check_convert(cls, text):
"""Converts and keeps only words in text deemed to be valid"""
text = cls.check_convert_string(text, name='text', no_leading_trailing_whitespace=False)
if len(text) > VALIDATION_META_SEARCH_TEXT:
raise ValueError("Search text can contain at... | [
"def",
"__search_text_check_convert",
"(",
"cls",
",",
"text",
")",
":",
"text",
"=",
"cls",
".",
"check_convert_string",
"(",
"text",
",",
"name",
"=",
"'text'",
",",
"no_leading_trailing_whitespace",
"=",
"False",
")",
"if",
"len",
"(",
"text",
")",
">",
... | Converts and keeps only words in text deemed to be valid | [
"Converts",
"and",
"keeps",
"only",
"words",
"in",
"text",
"deemed",
"to",
"be",
"valid"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L298-L306 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Validation.py | Validation.callable_check | def callable_check(func, arg_count=1, arg_value=None, allow_none=False):
"""Check whether func is callable, with the given number of positional arguments. Returns True if check
succeeded, False otherwise."""
if func is None:
if not allow_none:
raise ValueError('cal... | python | def callable_check(func, arg_count=1, arg_value=None, allow_none=False):
"""Check whether func is callable, with the given number of positional arguments. Returns True if check
succeeded, False otherwise."""
if func is None:
if not allow_none:
raise ValueError('cal... | [
"def",
"callable_check",
"(",
"func",
",",
"arg_count",
"=",
"1",
",",
"arg_value",
"=",
"None",
",",
"allow_none",
"=",
"False",
")",
":",
"if",
"func",
"is",
"None",
":",
"if",
"not",
"allow_none",
":",
"raise",
"ValueError",
"(",
"'callable cannot be No... | Check whether func is callable, with the given number of positional arguments. Returns True if check
succeeded, False otherwise. | [
"Check",
"whether",
"func",
"is",
"callable",
"with",
"the",
"given",
"number",
"of",
"positional",
"arguments",
".",
"Returns",
"True",
"if",
"check",
"succeeded",
"False",
"otherwise",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L309-L316 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.list_feeds | def list_feeds(self, limit=500, offset=0):
"""List `all` the feeds on this Thing.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkExcep... | python | def list_feeds(self, limit=500, offset=0):
"""List `all` the feeds on this Thing.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkExcep... | [
"def",
"list_feeds",
"(",
"self",
",",
"limit",
"=",
"500",
",",
"offset",
"=",
"0",
")",
":",
"return",
"self",
".",
"__list",
"(",
"R_FEED",
",",
"limit",
"=",
"limit",
",",
"offset",
"=",
"offset",
")",
"[",
"'feeds'",
"]"
] | List `all` the feeds on this Thing.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink... | [
"List",
"all",
"the",
"feeds",
"on",
"this",
"Thing",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L93-L108 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.list_controls | def list_controls(self, limit=500, offset=0):
"""List `all` the controls on this Thing.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [Lin... | python | def list_controls(self, limit=500, offset=0):
"""List `all` the controls on this Thing.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [Lin... | [
"def",
"list_controls",
"(",
"self",
",",
"limit",
"=",
"500",
",",
"offset",
"=",
"0",
")",
":",
"return",
"self",
".",
"__list",
"(",
"R_CONTROL",
",",
"limit",
"=",
"limit",
",",
"offset",
"=",
"offset",
")",
"[",
"'controls'",
"]"
] | List `all` the controls on this Thing.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpL... | [
"List",
"all",
"the",
"controls",
"on",
"this",
"Thing",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L110-L125 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.set_public | def set_public(self, public=True):
"""Sets your Thing to be public to all. If `public=True`.
This means the tags, label and description of your Thing are now searchable by anybody, along with its
location and the units of any values on any Points.
If `public=False` the metadata of your ... | python | def set_public(self, public=True):
"""Sets your Thing to be public to all. If `public=True`.
This means the tags, label and description of your Thing are now searchable by anybody, along with its
location and the units of any values on any Points.
If `public=False` the metadata of your ... | [
"def",
"set_public",
"(",
"self",
",",
"public",
"=",
"True",
")",
":",
"logger",
".",
"info",
"(",
"\"set_public(public=%s) [lid=%s]\"",
",",
"public",
",",
"self",
".",
"__lid",
")",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_meta_setpublic",
... | Sets your Thing to be public to all. If `public=True`.
This means the tags, label and description of your Thing are now searchable by anybody, along with its
location and the units of any values on any Points.
If `public=False` the metadata of your Thing is no longer searchable.
Raises... | [
"Sets",
"your",
"Thing",
"to",
"be",
"public",
"to",
"all",
".",
"If",
"public",
"=",
"True",
".",
"This",
"means",
"the",
"tags",
"label",
"and",
"description",
"of",
"your",
"Thing",
"are",
"now",
"searchable",
"by",
"anybody",
"along",
"with",
"its",
... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L127-L144 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.rename | def rename(self, new_lid):
"""Rename the Thing.
`ADVANCED USERS ONLY` This can be confusing. You are changing the local id of a Thing to `new_lid`. If you
create another Thing using the "old_lid", the system will oblige, but it will be a completely _new_ Thing.
Raises [IOTException]... | python | def rename(self, new_lid):
"""Rename the Thing.
`ADVANCED USERS ONLY` This can be confusing. You are changing the local id of a Thing to `new_lid`. If you
create another Thing using the "old_lid", the system will oblige, but it will be a completely _new_ Thing.
Raises [IOTException]... | [
"def",
"rename",
"(",
"self",
",",
"new_lid",
")",
":",
"logger",
".",
"info",
"(",
"\"rename(new_lid=\\\"%s\\\") [lid=%s]\"",
",",
"new_lid",
",",
"self",
".",
"__lid",
")",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_rename",
"(",
"self",
"."... | Rename the Thing.
`ADVANCED USERS ONLY` This can be confusing. You are changing the local id of a Thing to `new_lid`. If you
create another Thing using the "old_lid", the system will oblige, but it will be a completely _new_ Thing.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Ex... | [
"Rename",
"the",
"Thing",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L146-L164 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.reassign | def reassign(self, new_epid):
"""Reassign the Thing from one agent to another.
`ADVANCED USERS ONLY` This will lead to any local instances of a Thing being rendered useless.
They won't be able to receive control requests, feed data or to share any feeds as they won't be in this agent.
... | python | def reassign(self, new_epid):
"""Reassign the Thing from one agent to another.
`ADVANCED USERS ONLY` This will lead to any local instances of a Thing being rendered useless.
They won't be able to receive control requests, feed data or to share any feeds as they won't be in this agent.
... | [
"def",
"reassign",
"(",
"self",
",",
"new_epid",
")",
":",
"logger",
".",
"info",
"(",
"\"reassign(new_epid=\\\"%s\\\") [lid=%s]\"",
",",
"new_epid",
",",
"self",
".",
"__lid",
")",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_reassign",
"(",
"sel... | Reassign the Thing from one agent to another.
`ADVANCED USERS ONLY` This will lead to any local instances of a Thing being rendered useless.
They won't be able to receive control requests, feed data or to share any feeds as they won't be in this agent.
Raises [IOTException](./Exceptions.m.htm... | [
"Reassign",
"the",
"Thing",
"from",
"one",
"agent",
"to",
"another",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L166-L183 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.create_tag | def create_tag(self, tags):
"""Create tags for a Thing in the language you specify. Tags can only contain alphanumeric (unicode) characters
and the underscore. Tags will be stored lower-cased.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing t... | python | def create_tag(self, tags):
"""Create tags for a Thing in the language you specify. Tags can only contain alphanumeric (unicode) characters
and the underscore. Tags will be stored lower-cased.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing t... | [
"def",
"create_tag",
"(",
"self",
",",
"tags",
")",
":",
"if",
"isinstance",
"(",
"tags",
",",
"str",
")",
":",
"tags",
"=",
"[",
"tags",
"]",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_tag_update",
"(",
"self",
".",
"__lid",
",",
"tag... | Create tags for a Thing in the language you specify. Tags can only contain alphanumeric (unicode) characters
and the underscore. Tags will be stored lower-cased.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects ... | [
"Create",
"tags",
"for",
"a",
"Thing",
"in",
"the",
"language",
"you",
"specify",
".",
"Tags",
"can",
"only",
"contain",
"alphanumeric",
"(",
"unicode",
")",
"characters",
"and",
"the",
"underscore",
".",
"Tags",
"will",
"be",
"stored",
"lower",
"-",
"case... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L185-L202 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.delete_tag | def delete_tag(self, tags):
"""Delete tags for a Thing in the language you specify. Case will be ignored and any tags matching lower-cased
will be deleted.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detect... | python | def delete_tag(self, tags):
"""Delete tags for a Thing in the language you specify. Case will be ignored and any tags matching lower-cased
will be deleted.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detect... | [
"def",
"delete_tag",
"(",
"self",
",",
"tags",
")",
":",
"if",
"isinstance",
"(",
"tags",
",",
"str",
")",
":",
"tags",
"=",
"[",
"tags",
"]",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_tag_update",
"(",
"self",
".",
"__lid",
",",
"tag... | Delete tags for a Thing in the language you specify. Case will be ignored and any tags matching lower-cased
will be deleted.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkExcept... | [
"Delete",
"tags",
"for",
"a",
"Thing",
"in",
"the",
"language",
"you",
"specify",
".",
"Case",
"will",
"be",
"ignored",
"and",
"any",
"tags",
"matching",
"lower",
"-",
"cased",
"will",
"be",
"deleted",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L204-L221 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.list_tag | def list_tag(self, limit=500, offset=0):
"""List `all` the tags for this Thing
Returns lists of tags, as below
#!python
[
"mytag1",
"mytag2"
"ein_name",
"nochein_name"
]
- OR...
Raises... | python | def list_tag(self, limit=500, offset=0):
"""List `all` the tags for this Thing
Returns lists of tags, as below
#!python
[
"mytag1",
"mytag2"
"ein_name",
"nochein_name"
]
- OR...
Raises... | [
"def",
"list_tag",
"(",
"self",
",",
"limit",
"=",
"500",
",",
"offset",
"=",
"0",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_tag_list",
"(",
"self",
".",
"__lid",
",",
"limit",
"=",
"limit",
",",
"offset",
"=",
"offset",
")"... | List `all` the tags for this Thing
Returns lists of tags, as below
#!python
[
"mytag1",
"mytag2"
"ein_name",
"nochein_name"
]
- OR...
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.E... | [
"List",
"all",
"the",
"tags",
"for",
"this",
"Thing"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L223-L251 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.get_meta | def get_meta(self):
"""Get the metadata object for this Thing
Returns a [ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) object
"""
rdf = self.get_meta_rdf(fmt='n3')
return ThingMeta(self, rdf, self._client.default_lang, fmt='n3') | python | def get_meta(self):
"""Get the metadata object for this Thing
Returns a [ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) object
"""
rdf = self.get_meta_rdf(fmt='n3')
return ThingMeta(self, rdf, self._client.default_lang, fmt='n3') | [
"def",
"get_meta",
"(",
"self",
")",
":",
"rdf",
"=",
"self",
".",
"get_meta_rdf",
"(",
"fmt",
"=",
"'n3'",
")",
"return",
"ThingMeta",
"(",
"self",
",",
"rdf",
",",
"self",
".",
"_client",
".",
"default_lang",
",",
"fmt",
"=",
"'n3'",
")"
] | Get the metadata object for this Thing
Returns a [ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) object | [
"Get",
"the",
"metadata",
"object",
"for",
"this",
"Thing"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L253-L259 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.get_meta_rdf | def get_meta_rdf(self, fmt='n3'):
"""Get the metadata for this Thing in rdf fmt
Advanced users who want to manipulate the RDF for this Thing directly without the
[ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) helper object
Returns the RDF in the format you specify. - ... | python | def get_meta_rdf(self, fmt='n3'):
"""Get the metadata for this Thing in rdf fmt
Advanced users who want to manipulate the RDF for this Thing directly without the
[ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) helper object
Returns the RDF in the format you specify. - ... | [
"def",
"get_meta_rdf",
"(",
"self",
",",
"fmt",
"=",
"'n3'",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_meta_get",
"(",
"self",
".",
"__lid",
",",
"fmt",
"=",
"fmt",
")",
"self",
".",
"_client",
".",
"_wait_and_except_if_failed",
... | Get the metadata for this Thing in rdf fmt
Advanced users who want to manipulate the RDF for this Thing directly without the
[ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) helper object
Returns the RDF in the format you specify. - OR -
Raises [IOTException](./Excepti... | [
"Get",
"the",
"metadata",
"for",
"this",
"Thing",
"in",
"rdf",
"fmt"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L261-L281 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.set_meta_rdf | def set_meta_rdf(self, rdf, fmt='n3'):
"""Set the metadata for this Thing in RDF fmt
Advanced users who want to manipulate the RDF for this Thing directly without the
[ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) helper object
Raises [IOTException](./Exceptions.m.htm... | python | def set_meta_rdf(self, rdf, fmt='n3'):
"""Set the metadata for this Thing in RDF fmt
Advanced users who want to manipulate the RDF for this Thing directly without the
[ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) helper object
Raises [IOTException](./Exceptions.m.htm... | [
"def",
"set_meta_rdf",
"(",
"self",
",",
"rdf",
",",
"fmt",
"=",
"'n3'",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_entity_meta_set",
"(",
"self",
".",
"__lid",
",",
"rdf",
",",
"fmt",
"=",
"fmt",
")",
"self",
".",
"_client",
".",
... | Set the metadata for this Thing in RDF fmt
Advanced users who want to manipulate the RDF for this Thing directly without the
[ThingMeta](ThingMeta.m.html#IoticAgent.IOT.ThingMeta.ThingMeta) helper object
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
... | [
"Set",
"the",
"metadata",
"for",
"this",
"Thing",
"in",
"RDF",
"fmt"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L283-L299 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.get_feed | def get_feed(self, pid):
"""Get the details of a newly created feed. This only applies to asynchronous creation of feeds and the new feed
instance can only be retrieved once.
`NOTE` - Destructive Read. Once you've called get_feed once, any further calls will raise a `KeyError`
Returns ... | python | def get_feed(self, pid):
"""Get the details of a newly created feed. This only applies to asynchronous creation of feeds and the new feed
instance can only be retrieved once.
`NOTE` - Destructive Read. Once you've called get_feed once, any further calls will raise a `KeyError`
Returns ... | [
"def",
"get_feed",
"(",
"self",
",",
"pid",
")",
":",
"with",
"self",
".",
"__new_feeds",
":",
"try",
":",
"return",
"self",
".",
"__new_feeds",
".",
"pop",
"(",
"pid",
")",
"except",
"KeyError",
"as",
"ex",
":",
"raise_from",
"(",
"KeyError",
"(",
"... | Get the details of a newly created feed. This only applies to asynchronous creation of feeds and the new feed
instance can only be retrieved once.
`NOTE` - Destructive Read. Once you've called get_feed once, any further calls will raise a `KeyError`
Returns a [Feed](Point.m.html#IoticAgent.IOT... | [
"Get",
"the",
"details",
"of",
"a",
"newly",
"created",
"feed",
".",
"This",
"only",
"applies",
"to",
"asynchronous",
"creation",
"of",
"feeds",
"and",
"the",
"new",
"feed",
"instance",
"can",
"only",
"be",
"retrieved",
"once",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L301-L318 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.get_control | def get_control(self, pid):
"""Get the details of a newly created control. This only applies to asynchronous creation of feeds and the new
control instance can only be retrieved once.
`NOTE` - Destructive Read. Once you've called get_control once, any further calls will raise a `KeyError`
... | python | def get_control(self, pid):
"""Get the details of a newly created control. This only applies to asynchronous creation of feeds and the new
control instance can only be retrieved once.
`NOTE` - Destructive Read. Once you've called get_control once, any further calls will raise a `KeyError`
... | [
"def",
"get_control",
"(",
"self",
",",
"pid",
")",
":",
"with",
"self",
".",
"__new_controls",
":",
"try",
":",
"return",
"self",
".",
"__new_controls",
".",
"pop",
"(",
"pid",
")",
"except",
"KeyError",
"as",
"ex",
":",
"raise_from",
"(",
"KeyError",
... | Get the details of a newly created control. This only applies to asynchronous creation of feeds and the new
control instance can only be retrieved once.
`NOTE` - Destructive Read. Once you've called get_control once, any further calls will raise a `KeyError`
Returns a [Control](Point.m.html#Io... | [
"Get",
"the",
"details",
"of",
"a",
"newly",
"created",
"control",
".",
"This",
"only",
"applies",
"to",
"asynchronous",
"creation",
"of",
"feeds",
"and",
"the",
"new",
"control",
"instance",
"can",
"only",
"be",
"retrieved",
"once",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L320-L337 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.create_feed | def create_feed(self, pid, save_recent=0):
"""Create a new Feed for this Thing with a local point id (pid).
Returns a new [Feed](Point.m.html#IoticAgent.IOT.Point.Feed) object,
or the existing one, if the Feed already exists
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exce... | python | def create_feed(self, pid, save_recent=0):
"""Create a new Feed for this Thing with a local point id (pid).
Returns a new [Feed](Point.m.html#IoticAgent.IOT.Point.Feed) object,
or the existing one, if the Feed already exists
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exce... | [
"def",
"create_feed",
"(",
"self",
",",
"pid",
",",
"save_recent",
"=",
"0",
")",
":",
"logger",
".",
"info",
"(",
"\"create_feed(pid=\\\"%s\\\") [lid=%s]\"",
",",
"pid",
",",
"self",
".",
"__lid",
")",
"return",
"self",
".",
"__create_point",
"(",
"R_FEED",... | Create a new Feed for this Thing with a local point id (pid).
Returns a new [Feed](Point.m.html#IoticAgent.IOT.Point.Feed) object,
or the existing one, if the Feed already exists
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if t... | [
"Create",
"a",
"new",
"Feed",
"for",
"this",
"Thing",
"with",
"a",
"local",
"point",
"id",
"(",
"pid",
")",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L354-L374 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.create_control | def create_control(self, pid, callback, callback_parsed=None):
"""Create a control for this Thing with a local point id (pid) and a control request feedback
Returns a new [Control](Point.m.html#IoticAgent.IOT.Point.Control) object
or the existing one if the Control already exists
Raise... | python | def create_control(self, pid, callback, callback_parsed=None):
"""Create a control for this Thing with a local point id (pid) and a control request feedback
Returns a new [Control](Point.m.html#IoticAgent.IOT.Point.Control) object
or the existing one if the Control already exists
Raise... | [
"def",
"create_control",
"(",
"self",
",",
"pid",
",",
"callback",
",",
"callback_parsed",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"\"create_control(pid=\\\"%s\\\", control_cb=%s) [lid=%s]\"",
",",
"pid",
",",
"callback",
",",
"self",
".",
"__lid",
")... | Create a control for this Thing with a local point id (pid) and a control request feedback
Returns a new [Control](Point.m.html#IoticAgent.IOT.Point.Control) object
or the existing one if the Control already exists
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTExceptio... | [
"Create",
"a",
"control",
"for",
"this",
"Thing",
"with",
"a",
"local",
"point",
"id",
"(",
"pid",
")",
"and",
"a",
"control",
"request",
"feedback"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L380-L417 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.delete_feed | def delete_feed(self, pid):
"""Delete a feed, identified by its local id.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLi... | python | def delete_feed(self, pid):
"""Delete a feed, identified by its local id.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLi... | [
"def",
"delete_feed",
"(",
"self",
",",
"pid",
")",
":",
"logger",
".",
"info",
"(",
"\"delete_feed(pid=\\\"%s\\\") [lid=%s]\"",
",",
"pid",
",",
"self",
".",
"__lid",
")",
"return",
"self",
".",
"__delete_point",
"(",
"R_FEED",
",",
"pid",
")"
] | Delete a feed, identified by its local id.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException)
if there is a... | [
"Delete",
"a",
"feed",
"identified",
"by",
"its",
"local",
"id",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L432-L445 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.delete_control | def delete_control(self, pid):
"""Delete a control, identified by its local id.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.... | python | def delete_control(self, pid):
"""Delete a control, identified by its local id.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.... | [
"def",
"delete_control",
"(",
"self",
",",
"pid",
")",
":",
"logger",
".",
"info",
"(",
"\"delete_control(pid=\\\"%s\\\") [lid=%s]\"",
",",
"pid",
",",
"self",
".",
"__lid",
")",
"return",
"self",
".",
"__delete_point",
"(",
"R_CONTROL",
",",
"pid",
")"
] | Delete a control, identified by its local id.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException)
if there i... | [
"Delete",
"a",
"control",
"identified",
"by",
"its",
"local",
"id",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L451-L463 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.__sub_add_reference | def __sub_add_reference(self, key):
"""Used by __sub_make_request to save reference for pending sub request"""
new_subs = self.__new_subs
with new_subs:
# don't allow multiple subscription requests to overwrite internal reference
if key in new_subs:
raise ... | python | def __sub_add_reference(self, key):
"""Used by __sub_make_request to save reference for pending sub request"""
new_subs = self.__new_subs
with new_subs:
# don't allow multiple subscription requests to overwrite internal reference
if key in new_subs:
raise ... | [
"def",
"__sub_add_reference",
"(",
"self",
",",
"key",
")",
":",
"new_subs",
"=",
"self",
".",
"__new_subs",
"with",
"new_subs",
":",
"# don't allow multiple subscription requests to overwrite internal reference",
"if",
"key",
"in",
"new_subs",
":",
"raise",
"ValueError... | Used by __sub_make_request to save reference for pending sub request | [
"Used",
"by",
"__sub_make_request",
"to",
"save",
"reference",
"for",
"pending",
"sub",
"request"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L514-L528 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.__sub_del_reference | def __sub_del_reference(self, req, key):
"""Blindly clear reference to pending subscription on failure."""
if not req.success:
try:
self.__new_subs.pop(key)
except KeyError:
logger.warning('No sub ref %s', key) | python | def __sub_del_reference(self, req, key):
"""Blindly clear reference to pending subscription on failure."""
if not req.success:
try:
self.__new_subs.pop(key)
except KeyError:
logger.warning('No sub ref %s', key) | [
"def",
"__sub_del_reference",
"(",
"self",
",",
"req",
",",
"key",
")",
":",
"if",
"not",
"req",
".",
"success",
":",
"try",
":",
"self",
".",
"__new_subs",
".",
"pop",
"(",
"key",
")",
"except",
"KeyError",
":",
"logger",
".",
"warning",
"(",
"'No s... | Blindly clear reference to pending subscription on failure. | [
"Blindly",
"clear",
"reference",
"to",
"pending",
"subscription",
"on",
"failure",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L530-L536 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.__sub_make_request | def __sub_make_request(self, foc, gpid, callback):
"""Make right subscription request depending on whether local or global - used by __sub*"""
# global
if isinstance(gpid, string_types):
gpid = uuid_to_hex(gpid)
ref = (foc, gpid)
with self.__sub_add_reference(... | python | def __sub_make_request(self, foc, gpid, callback):
"""Make right subscription request depending on whether local or global - used by __sub*"""
# global
if isinstance(gpid, string_types):
gpid = uuid_to_hex(gpid)
ref = (foc, gpid)
with self.__sub_add_reference(... | [
"def",
"__sub_make_request",
"(",
"self",
",",
"foc",
",",
"gpid",
",",
"callback",
")",
":",
"# global",
"if",
"isinstance",
"(",
"gpid",
",",
"string_types",
")",
":",
"gpid",
"=",
"uuid_to_hex",
"(",
"gpid",
")",
"ref",
"=",
"(",
"foc",
",",
"gpid",... | Make right subscription request depending on whether local or global - used by __sub* | [
"Make",
"right",
"subscription",
"request",
"depending",
"on",
"whether",
"local",
"or",
"global",
"-",
"used",
"by",
"__sub",
"*"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L538-L555 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.follow | def follow(self, gpid, callback=None, callback_parsed=None):
"""Create a subscription (i.e. follow) a Feed/Point with a global point id (gpid) and a feed data callback
Returns a new [RemoteFeed](RemotePoint.m.html#IoticAgent.IOT.RemotePoint.RemoteFeed)
object or the existing one if the subscrip... | python | def follow(self, gpid, callback=None, callback_parsed=None):
"""Create a subscription (i.e. follow) a Feed/Point with a global point id (gpid) and a feed data callback
Returns a new [RemoteFeed](RemotePoint.m.html#IoticAgent.IOT.RemotePoint.RemoteFeed)
object or the existing one if the subscrip... | [
"def",
"follow",
"(",
"self",
",",
"gpid",
",",
"callback",
"=",
"None",
",",
"callback_parsed",
"=",
"None",
")",
":",
"if",
"callback_parsed",
":",
"callback",
"=",
"self",
".",
"_client",
".",
"_get_parsed_feed_callback",
"(",
"callback_parsed",
",",
"cal... | Create a subscription (i.e. follow) a Feed/Point with a global point id (gpid) and a feed data callback
Returns a new [RemoteFeed](RemotePoint.m.html#IoticAgent.IOT.RemotePoint.RemoteFeed)
object or the existing one if the subscription already exists - OR -
Raises [IOTException](./Exceptions.m... | [
"Create",
"a",
"subscription",
"(",
"i",
".",
"e",
".",
"follow",
")",
"a",
"Feed",
"/",
"Point",
"with",
"a",
"global",
"point",
"id",
"(",
"gpid",
")",
"and",
"a",
"feed",
"data",
"callback"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L572-L607 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing.list_connections | def list_connections(self, limit=500, offset=0):
"""List Points to which this Things is subscribed.
I.e. list all the Points this Thing is following and controls it's attached to
Returns subscription list e.g.
#!python
{
"<Subscription GUID 1>": {
... | python | def list_connections(self, limit=500, offset=0):
"""List Points to which this Things is subscribed.
I.e. list all the Points this Thing is following and controls it's attached to
Returns subscription list e.g.
#!python
{
"<Subscription GUID 1>": {
... | [
"def",
"list_connections",
"(",
"self",
",",
"limit",
"=",
"500",
",",
"offset",
"=",
"0",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_sub_list",
"(",
"self",
".",
"__lid",
",",
"limit",
"=",
"limit",
",",
"offset",
"=",
"offset",
")... | List Points to which this Things is subscribed.
I.e. list all the Points this Thing is following and controls it's attached to
Returns subscription list e.g.
#!python
{
"<Subscription GUID 1>": {
"id": "<Control GUID>",
"e... | [
"List",
"Points",
"to",
"which",
"this",
"Things",
"is",
"subscribed",
".",
"I",
".",
"e",
".",
"list",
"all",
"the",
"Points",
"this",
"Thing",
"is",
"following",
"and",
"controls",
"it",
"s",
"attached",
"to"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L671-L702 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Thing.py | Thing._cb_created | def _cb_created(self, payload, duplicated):
"""Indirect callback (via Client) for point & subscription creation responses"""
if payload[P_RESOURCE] in _POINT_TYPE_TO_CLASS:
store = self.__new_feeds if payload[P_RESOURCE] == R_FEED else self.__new_controls
cls = _POINT_TYPE_TO_CLA... | python | def _cb_created(self, payload, duplicated):
"""Indirect callback (via Client) for point & subscription creation responses"""
if payload[P_RESOURCE] in _POINT_TYPE_TO_CLASS:
store = self.__new_feeds if payload[P_RESOURCE] == R_FEED else self.__new_controls
cls = _POINT_TYPE_TO_CLA... | [
"def",
"_cb_created",
"(",
"self",
",",
"payload",
",",
"duplicated",
")",
":",
"if",
"payload",
"[",
"P_RESOURCE",
"]",
"in",
"_POINT_TYPE_TO_CLASS",
":",
"store",
"=",
"self",
".",
"__new_feeds",
"if",
"payload",
"[",
"P_RESOURCE",
"]",
"==",
"R_FEED",
"... | Indirect callback (via Client) for point & subscription creation responses | [
"Indirect",
"callback",
"(",
"via",
"Client",
")",
"for",
"point",
"&",
"subscription",
"creation",
"responses"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L704-L732 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/third/amqp/abstract_channel.py | AbstractChannel.wait | def wait(self, allowed_methods=None):
"""Wait for a method that matches our allowed_methods parameter (the
default value of None means match any method), and dispatch to it."""
method_sig, args, content = self.connection._wait_method(
self.channel_id, allowed_methods)
return... | python | def wait(self, allowed_methods=None):
"""Wait for a method that matches our allowed_methods parameter (the
default value of None means match any method), and dispatch to it."""
method_sig, args, content = self.connection._wait_method(
self.channel_id, allowed_methods)
return... | [
"def",
"wait",
"(",
"self",
",",
"allowed_methods",
"=",
"None",
")",
":",
"method_sig",
",",
"args",
",",
"content",
"=",
"self",
".",
"connection",
".",
"_wait_method",
"(",
"self",
".",
"channel_id",
",",
"allowed_methods",
")",
"return",
"self",
".",
... | Wait for a method that matches our allowed_methods parameter (the
default value of None means match any method), and dispatch to it. | [
"Wait",
"for",
"a",
"method",
"that",
"matches",
"our",
"allowed_methods",
"parameter",
"(",
"the",
"default",
"value",
"of",
"None",
"means",
"match",
"any",
"method",
")",
"and",
"dispatch",
"to",
"it",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/third/amqp/abstract_channel.py#L63-L69 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/RemotePoint.py | RemoteFeed.get_recent | def get_recent(self, count):
"""Get the last instance(s) of feeddata from the feed. Useful if the remote Thing doesn't publish very often.
Returns an iterable of dicts (in chronologically ascending order) containing:
#!python
'data' # (decoded or raw bytes)
'mime' # ... | python | def get_recent(self, count):
"""Get the last instance(s) of feeddata from the feed. Useful if the remote Thing doesn't publish very often.
Returns an iterable of dicts (in chronologically ascending order) containing:
#!python
'data' # (decoded or raw bytes)
'mime' # ... | [
"def",
"get_recent",
"(",
"self",
",",
"count",
")",
":",
"queue",
"=",
"Queue",
"(",
")",
"evt",
"=",
"self",
".",
"get_recent_async",
"(",
"count",
",",
"queue",
".",
"put",
")",
"timeout_time",
"=",
"monotonic",
"(",
")",
"+",
"self",
".",
"_clien... | Get the last instance(s) of feeddata from the feed. Useful if the remote Thing doesn't publish very often.
Returns an iterable of dicts (in chronologically ascending order) containing:
#!python
'data' # (decoded or raw bytes)
'mime' # (None, unless payload was not decoded an... | [
"Get",
"the",
"last",
"instance",
"(",
"s",
")",
"of",
"feeddata",
"from",
"the",
"feed",
".",
"Useful",
"if",
"the",
"remote",
"Thing",
"doesn",
"t",
"publish",
"very",
"often",
".",
"Returns",
"an",
"iterable",
"of",
"dicts",
"(",
"in",
"chronologicall... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L86-L110 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/RemotePoint.py | RemoteFeed.get_recent_async | def get_recent_async(self, count, callback):
"""Similar to `get_recent` except instead of returning an iterable, passes each dict to the given function which
must accept a single argument. Returns the request.
`callback` (mandatory) (function) instead of returning an iterable, pass each dict (a... | python | def get_recent_async(self, count, callback):
"""Similar to `get_recent` except instead of returning an iterable, passes each dict to the given function which
must accept a single argument. Returns the request.
`callback` (mandatory) (function) instead of returning an iterable, pass each dict (a... | [
"def",
"get_recent_async",
"(",
"self",
",",
"count",
",",
"callback",
")",
":",
"validate_nonnegative_int",
"(",
"count",
",",
"'count'",
")",
"Validation",
".",
"callable_check",
"(",
"callback",
",",
"allow_none",
"=",
"True",
")",
"evt",
"=",
"self",
"."... | Similar to `get_recent` except instead of returning an iterable, passes each dict to the given function which
must accept a single argument. Returns the request.
`callback` (mandatory) (function) instead of returning an iterable, pass each dict (as described above) to the
given function which m... | [
"Similar",
"to",
"get_recent",
"except",
"instead",
"of",
"returning",
"an",
"iterable",
"passes",
"each",
"dict",
"to",
"the",
"given",
"function",
"which",
"must",
"accept",
"a",
"single",
"argument",
".",
"Returns",
"the",
"request",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L112-L123 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/RemotePoint.py | RemoteFeed.simulate | def simulate(self, data, mime=None):
"""Simulate the arrival of feeddata into the feed. Useful if the remote Thing doesn't publish
very often.
`data` (mandatory) (as applicable) The data you want to use to simulate the arrival of remote feed data
`mime` (optional) (string) The mime ty... | python | def simulate(self, data, mime=None):
"""Simulate the arrival of feeddata into the feed. Useful if the remote Thing doesn't publish
very often.
`data` (mandatory) (as applicable) The data you want to use to simulate the arrival of remote feed data
`mime` (optional) (string) The mime ty... | [
"def",
"simulate",
"(",
"self",
",",
"data",
",",
"mime",
"=",
"None",
")",
":",
"self",
".",
"_client",
".",
"simulate_feeddata",
"(",
"self",
".",
"__pointid",
",",
"data",
",",
"mime",
")"
] | Simulate the arrival of feeddata into the feed. Useful if the remote Thing doesn't publish
very often.
`data` (mandatory) (as applicable) The data you want to use to simulate the arrival of remote feed data
`mime` (optional) (string) The mime type of your data. See:
[share()](./Point... | [
"Simulate",
"the",
"arrival",
"of",
"feeddata",
"into",
"the",
"feed",
".",
"Useful",
"if",
"the",
"remote",
"Thing",
"doesn",
"t",
"publish",
"very",
"often",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L125-L134 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/RemotePoint.py | RemoteControl.ask | def ask(self, data, mime=None):
"""Request a remote control to do something. Ask is "fire-and-forget" in that you won't receive
any notification of the success or otherwise of the action at the far end.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
c... | python | def ask(self, data, mime=None):
"""Request a remote control to do something. Ask is "fire-and-forget" in that you won't receive
any notification of the success or otherwise of the action at the far end.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
c... | [
"def",
"ask",
"(",
"self",
",",
"data",
",",
"mime",
"=",
"None",
")",
":",
"evt",
"=",
"self",
".",
"ask_async",
"(",
"data",
",",
"mime",
"=",
"mime",
")",
"self",
".",
"_client",
".",
"_wait_and_except_if_failed",
"(",
"evt",
")"
] | Request a remote control to do something. Ask is "fire-and-forget" in that you won't receive
any notification of the success or otherwise of the action at the far end.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure d... | [
"Request",
"a",
"remote",
"control",
"to",
"do",
"something",
".",
"Ask",
"is",
"fire",
"-",
"and",
"-",
"forget",
"in",
"that",
"you",
"won",
"t",
"receive",
"any",
"notification",
"of",
"the",
"success",
"or",
"otherwise",
"of",
"the",
"action",
"at",
... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L156-L172 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/RemotePoint.py | RemoteControl.tell | def tell(self, data, timeout=10, mime=None):
"""Order a remote control to do something. Tell is confirmed in that you will receive
a notification of the success or otherwise of the action at the far end via a callback
`Example`
#!python
data = {"thermostat":18.0}
... | python | def tell(self, data, timeout=10, mime=None):
"""Order a remote control to do something. Tell is confirmed in that you will receive
a notification of the success or otherwise of the action at the far end via a callback
`Example`
#!python
data = {"thermostat":18.0}
... | [
"def",
"tell",
"(",
"self",
",",
"data",
",",
"timeout",
"=",
"10",
",",
"mime",
"=",
"None",
")",
":",
"evt",
"=",
"self",
".",
"tell_async",
"(",
"data",
",",
"timeout",
"=",
"timeout",
",",
"mime",
"=",
"mime",
")",
"# No point in waiting longer tha... | Order a remote control to do something. Tell is confirmed in that you will receive
a notification of the success or otherwise of the action at the far end via a callback
`Example`
#!python
data = {"thermostat":18.0}
retval = r_thermostat.tell(data, timeout=10, mime... | [
"Order",
"a",
"remote",
"control",
"to",
"do",
"something",
".",
"Tell",
"is",
"confirmed",
"in",
"that",
"you",
"will",
"receive",
"a",
"notification",
"of",
"the",
"success",
"or",
"otherwise",
"of",
"the",
"action",
"at",
"the",
"far",
"end",
"via",
"... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L180-L220 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/RemotePoint.py | RemoteControl.tell_async | def tell_async(self, data, timeout=10, mime=None):
"""Asyncronous version of [tell()](./RemotePoint.m.html#IoticAgent.IOT.RemotePoint.RemoteControl.tell)
`Note` payload contains the success and reason keys they are not separated out as in the synchronous version
"""
logger.info("tell(ti... | python | def tell_async(self, data, timeout=10, mime=None):
"""Asyncronous version of [tell()](./RemotePoint.m.html#IoticAgent.IOT.RemotePoint.RemoteControl.tell)
`Note` payload contains the success and reason keys they are not separated out as in the synchronous version
"""
logger.info("tell(ti... | [
"def",
"tell_async",
"(",
"self",
",",
"data",
",",
"timeout",
"=",
"10",
",",
"mime",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"\"tell(timeout=%s) [subid=%s]\"",
",",
"timeout",
",",
"self",
".",
"subid",
")",
"if",
"mime",
"is",
"None",
"an... | Asyncronous version of [tell()](./RemotePoint.m.html#IoticAgent.IOT.RemotePoint.RemoteControl.tell)
`Note` payload contains the success and reason keys they are not separated out as in the synchronous version | [
"Asyncronous",
"version",
"of",
"[",
"tell",
"()",
"]",
"(",
".",
"/",
"RemotePoint",
".",
"m",
".",
"html#IoticAgent",
".",
"IOT",
".",
"RemotePoint",
".",
"RemoteControl",
".",
"tell",
")"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L222-L230 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.rename | def rename(self, new_pid):
"""Rename the Point.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException)
... | python | def rename(self, new_pid):
"""Rename the Point.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException)
... | [
"def",
"rename",
"(",
"self",
",",
"new_pid",
")",
":",
"logger",
".",
"info",
"(",
"\"rename(new_pid=\\\"%s\\\") [lid=%s, pid=%s]\"",
",",
"new_pid",
",",
"self",
".",
"__lid",
",",
"self",
".",
"__pid",
")",
"evt",
"=",
"self",
".",
"_client",
".",
"_req... | Rename the Point.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException)
if there is a communications problem b... | [
"Rename",
"the",
"Point",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L86-L100 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.list | def list(self, limit=50, offset=0):
"""List `all` the values on this Point.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](... | python | def list(self, limit=50, offset=0):
"""List `all` the values on this Point.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](... | [
"def",
"list",
"(",
"self",
",",
"limit",
"=",
"50",
",",
"offset",
"=",
"0",
")",
":",
"logger",
".",
"info",
"(",
"\"list(limit=%s, offset=%s) [lid=%s,pid=%s]\"",
",",
"limit",
",",
"offset",
",",
"self",
".",
"__lid",
",",
"self",
".",
"__pid",
")",
... | List `all` the values on this Point.
Returns QAPI list function payload
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLin... | [
"List",
"all",
"the",
"values",
"on",
"this",
"Point",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L102-L121 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.list_followers | def list_followers(self):
"""list followers for this point, i.e. remote follows for feeds and remote attaches for controls.
Returns QAPI subscription list function payload
#!python
{
"<Subscription GUID 1>": "<GUID of follower1>",
"<Subscription ... | python | def list_followers(self):
"""list followers for this point, i.e. remote follows for feeds and remote attaches for controls.
Returns QAPI subscription list function payload
#!python
{
"<Subscription GUID 1>": "<GUID of follower1>",
"<Subscription ... | [
"def",
"list_followers",
"(",
"self",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_list_detailed",
"(",
"self",
".",
"_type",
",",
"self",
".",
"__lid",
",",
"self",
".",
"__pid",
")",
"self",
".",
"_client",
".",
"_wait_and_except_if... | list followers for this point, i.e. remote follows for feeds and remote attaches for controls.
Returns QAPI subscription list function payload
#!python
{
"<Subscription GUID 1>": "<GUID of follower1>",
"<Subscription GUID 2>": "<GUID of follower2>"
... | [
"list",
"followers",
"for",
"this",
"point",
"i",
".",
"e",
".",
"remote",
"follows",
"for",
"feeds",
"and",
"remote",
"attaches",
"for",
"controls",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L123-L147 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.get_meta | def get_meta(self):
"""Get the metadata object for this Point
Returns a [PointMeta](PointMeta.m.html#IoticAgent.IOT.PointMeta.PointMeta) object - OR -
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a ... | python | def get_meta(self):
"""Get the metadata object for this Point
Returns a [PointMeta](PointMeta.m.html#IoticAgent.IOT.PointMeta.PointMeta) object - OR -
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a ... | [
"def",
"get_meta",
"(",
"self",
")",
":",
"rdf",
"=",
"self",
".",
"get_meta_rdf",
"(",
"fmt",
"=",
"'n3'",
")",
"return",
"PointMeta",
"(",
"self",
",",
"rdf",
",",
"self",
".",
"_client",
".",
"default_lang",
",",
"fmt",
"=",
"'n3'",
")"
] | Get the metadata object for this Point
Returns a [PointMeta](PointMeta.m.html#IoticAgent.IOT.PointMeta.PointMeta) object - OR -
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkEx... | [
"Get",
"the",
"metadata",
"object",
"for",
"this",
"Point"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L149-L161 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.get_meta_rdf | def get_meta_rdf(self, fmt='n3'):
"""Get the metadata for this Point in rdf fmt
Advanced users who want to manipulate the RDF for this Point directly without the
[PointMeta](PointMeta.m.html#IoticAgent.IOT.PointMeta.PointMeta) helper object
Returns the RDF in the format you specify. - ... | python | def get_meta_rdf(self, fmt='n3'):
"""Get the metadata for this Point in rdf fmt
Advanced users who want to manipulate the RDF for this Point directly without the
[PointMeta](PointMeta.m.html#IoticAgent.IOT.PointMeta.PointMeta) helper object
Returns the RDF in the format you specify. - ... | [
"def",
"get_meta_rdf",
"(",
"self",
",",
"fmt",
"=",
"'n3'",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_meta_get",
"(",
"self",
".",
"_type",
",",
"self",
".",
"__lid",
",",
"self",
".",
"__pid",
",",
"fmt",
"=",
"fmt",
")",
... | Get the metadata for this Point in rdf fmt
Advanced users who want to manipulate the RDF for this Point directly without the
[PointMeta](PointMeta.m.html#IoticAgent.IOT.PointMeta.PointMeta) helper object
Returns the RDF in the format you specify. - OR -
Raises [IOTException](./Excepti... | [
"Get",
"the",
"metadata",
"for",
"this",
"Point",
"in",
"rdf",
"fmt"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L163-L183 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.set_meta_rdf | def set_meta_rdf(self, rdf, fmt='n3'):
"""Set the metadata for this Point in rdf fmt
"""
evt = self._client._request_point_meta_set(self._type, self.__lid, self.__pid, rdf, fmt=fmt)
self._client._wait_and_except_if_failed(evt) | python | def set_meta_rdf(self, rdf, fmt='n3'):
"""Set the metadata for this Point in rdf fmt
"""
evt = self._client._request_point_meta_set(self._type, self.__lid, self.__pid, rdf, fmt=fmt)
self._client._wait_and_except_if_failed(evt) | [
"def",
"set_meta_rdf",
"(",
"self",
",",
"rdf",
",",
"fmt",
"=",
"'n3'",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_meta_set",
"(",
"self",
".",
"_type",
",",
"self",
".",
"__lid",
",",
"self",
".",
"__pid",
",",
"rdf",
",",
... | Set the metadata for this Point in rdf fmt | [
"Set",
"the",
"metadata",
"for",
"this",
"Point",
"in",
"rdf",
"fmt"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L185-L189 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.create_tag | def create_tag(self, tags):
"""Create tags for a Point in the language you specify. Tags can only contain alphanumeric (unicode) characters
and the underscore. Tags will be stored lower-cased.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing t... | python | def create_tag(self, tags):
"""Create tags for a Point in the language you specify. Tags can only contain alphanumeric (unicode) characters
and the underscore. Tags will be stored lower-cased.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing t... | [
"def",
"create_tag",
"(",
"self",
",",
"tags",
")",
":",
"if",
"isinstance",
"(",
"tags",
",",
"str",
")",
":",
"tags",
"=",
"[",
"tags",
"]",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_tag_update",
"(",
"self",
".",
"_type",
",",
"self... | Create tags for a Point in the language you specify. Tags can only contain alphanumeric (unicode) characters
and the underscore. Tags will be stored lower-cased.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects ... | [
"Create",
"tags",
"for",
"a",
"Point",
"in",
"the",
"language",
"you",
"specify",
".",
"Tags",
"can",
"only",
"contain",
"alphanumeric",
"(",
"unicode",
")",
"characters",
"and",
"the",
"underscore",
".",
"Tags",
"will",
"be",
"stored",
"lower",
"-",
"case... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L191-L208 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.delete_tag | def delete_tag(self, tags):
"""Delete tags for a Point in the language you specify. Case will be ignored and any tags matching lower-cased
will be deleted.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detect... | python | def delete_tag(self, tags):
"""Delete tags for a Point in the language you specify. Case will be ignored and any tags matching lower-cased
will be deleted.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detect... | [
"def",
"delete_tag",
"(",
"self",
",",
"tags",
")",
":",
"if",
"isinstance",
"(",
"tags",
",",
"str",
")",
":",
"tags",
"=",
"[",
"tags",
"]",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_tag_update",
"(",
"self",
".",
"_type",
",",
"self... | Delete tags for a Point in the language you specify. Case will be ignored and any tags matching lower-cased
will be deleted.
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkExcept... | [
"Delete",
"tags",
"for",
"a",
"Point",
"in",
"the",
"language",
"you",
"specify",
".",
"Case",
"will",
"be",
"ignored",
"and",
"any",
"tags",
"matching",
"lower",
"-",
"cased",
"will",
"be",
"deleted",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L210-L227 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.list_tag | def list_tag(self, limit=50, offset=0):
"""List `all` the tags for this Point
Returns list of tags, as below
#!python
[
"mytag1",
"mytag2"
"ein_name",
"nochein_name"
]
- OR...
Raises [... | python | def list_tag(self, limit=50, offset=0):
"""List `all` the tags for this Point
Returns list of tags, as below
#!python
[
"mytag1",
"mytag2"
"ein_name",
"nochein_name"
]
- OR...
Raises [... | [
"def",
"list_tag",
"(",
"self",
",",
"limit",
"=",
"50",
",",
"offset",
"=",
"0",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_tag_list",
"(",
"self",
".",
"_type",
",",
"self",
".",
"__lid",
",",
"self",
".",
"__pid",
",",
"l... | List `all` the tags for this Point
Returns list of tags, as below
#!python
[
"mytag1",
"mytag2"
"ein_name",
"nochein_name"
]
- OR...
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Ex... | [
"List",
"all",
"the",
"tags",
"for",
"this",
"Point"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L229-L257 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.create_value | def create_value(self, label, vtype, lang=None, description=None, unit=None):
"""Create a value on this Point. Values are descriptions in semantic metadata of the individual data items
you are sharing (or expecting to receive, if this Point is a control). This will help others to search for
yo... | python | def create_value(self, label, vtype, lang=None, description=None, unit=None):
"""Create a value on this Point. Values are descriptions in semantic metadata of the individual data items
you are sharing (or expecting to receive, if this Point is a control). This will help others to search for
yo... | [
"def",
"create_value",
"(",
"self",
",",
"label",
",",
"vtype",
",",
"lang",
"=",
"None",
",",
"description",
"=",
"None",
",",
"unit",
"=",
"None",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_value_create",
"(",
"self",
".",
"__... | Create a value on this Point. Values are descriptions in semantic metadata of the individual data items
you are sharing (or expecting to receive, if this Point is a control). This will help others to search for
your feed or control. If a value with the given label (and language) already exists, its fi... | [
"Create",
"a",
"value",
"on",
"this",
"Point",
".",
"Values",
"are",
"descriptions",
"in",
"semantic",
"metadata",
"of",
"the",
"individual",
"data",
"items",
"you",
"are",
"sharing",
"(",
"or",
"expecting",
"to",
"receive",
"if",
"this",
"Point",
"is",
"a... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L259-L305 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Point.delete_value | def delete_value(self, label=None):
"""Delete the labelled value (or all values) on this Point
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#I... | python | def delete_value(self, label=None):
"""Delete the labelled value (or all values) on this Point
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#I... | [
"def",
"delete_value",
"(",
"self",
",",
"label",
"=",
"None",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_value_delete",
"(",
"self",
".",
"__lid",
",",
"self",
".",
"__pid",
",",
"self",
".",
"_type",
",",
"label",
"=",
"label"... | Delete the labelled value (or all values) on this Point
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException)
... | [
"Delete",
"the",
"labelled",
"value",
"(",
"or",
"all",
"values",
")",
"on",
"this",
"Point"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L307-L320 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Feed.share | def share(self, data, mime=None, time=None):
"""Share some data from this Feed
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.A... | python | def share(self, data, mime=None, time=None):
"""Share some data from this Feed
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.A... | [
"def",
"share",
"(",
"self",
",",
"data",
",",
"mime",
"=",
"None",
",",
"time",
"=",
"None",
")",
":",
"evt",
"=",
"self",
".",
"share_async",
"(",
"data",
",",
"mime",
"=",
"mime",
",",
"time",
"=",
"time",
")",
"self",
".",
"_client",
".",
"... | Share some data from this Feed
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
Raises [LinkException](../Core/AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException)
if there is a communicati... | [
"Share",
"some",
"data",
"from",
"this",
"Feed"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L334-L375 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Feed.get_recent_info | def get_recent_info(self):
"""Retrieves statistics and configuration about recent storage for this Feed.
Returns QAPI recent info function payload
#!python
{
"maxSamples": 0,
"count": 0
}
Raises [IOTException](./Exceptions.m.... | python | def get_recent_info(self):
"""Retrieves statistics and configuration about recent storage for this Feed.
Returns QAPI recent info function payload
#!python
{
"maxSamples": 0,
"count": 0
}
Raises [IOTException](./Exceptions.m.... | [
"def",
"get_recent_info",
"(",
"self",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_recent_info",
"(",
"self",
".",
"_type",
",",
"self",
".",
"lid",
",",
"self",
".",
"pid",
")",
"self",
".",
"_client",
".",
"_wait_and_except_if_fail... | Retrieves statistics and configuration about recent storage for this Feed.
Returns QAPI recent info function payload
#!python
{
"maxSamples": 0,
"count": 0
}
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTExce... | [
"Retrieves",
"statistics",
"and",
"configuration",
"about",
"recent",
"storage",
"for",
"this",
"Feed",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L383-L403 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | Feed.set_recent_config | def set_recent_config(self, max_samples=0):
"""Update/configure recent data settings for this Feed. If the container does not support recent storage or it
is not enabled for this owner, this function will have no effect.
`max_samples` (optional) (int) how many shares to store for later retrieva... | python | def set_recent_config(self, max_samples=0):
"""Update/configure recent data settings for this Feed. If the container does not support recent storage or it
is not enabled for this owner, this function will have no effect.
`max_samples` (optional) (int) how many shares to store for later retrieva... | [
"def",
"set_recent_config",
"(",
"self",
",",
"max_samples",
"=",
"0",
")",
":",
"evt",
"=",
"self",
".",
"_client",
".",
"_request_point_recent_config",
"(",
"self",
".",
"_type",
",",
"self",
".",
"lid",
",",
"self",
".",
"pid",
",",
"max_samples",
")"... | Update/configure recent data settings for this Feed. If the container does not support recent storage or it
is not enabled for this owner, this function will have no effect.
`max_samples` (optional) (int) how many shares to store for later retrieval. If not supported by container, this
argument... | [
"Update",
"/",
"configure",
"recent",
"data",
"settings",
"for",
"this",
"Feed",
".",
"If",
"the",
"container",
"does",
"not",
"support",
"recent",
"storage",
"or",
"it",
"is",
"not",
"enabled",
"for",
"this",
"owner",
"this",
"function",
"will",
"have",
"... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L405-L429 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | PointDataObject.filter_by | def filter_by(self, text=(), types=(), units=(), include_unset=False):
"""Return subset of values which match the given text, types and/or units. For a value to be matched, at least
one item from each specified filter category has to apply to a value. Each of the categories must be specified
as ... | python | def filter_by(self, text=(), types=(), units=(), include_unset=False):
"""Return subset of values which match the given text, types and/or units. For a value to be matched, at least
one item from each specified filter category has to apply to a value. Each of the categories must be specified
as ... | [
"def",
"filter_by",
"(",
"self",
",",
"text",
"=",
"(",
")",
",",
"types",
"=",
"(",
")",
",",
"units",
"=",
"(",
")",
",",
"include_unset",
"=",
"False",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"text",
",",
"Sequence",
")",
"and",
"all",
... | Return subset of values which match the given text, types and/or units. For a value to be matched, at least
one item from each specified filter category has to apply to a value. Each of the categories must be specified
as a sequence of strings. If `include_unset` is set, unset values will also be consid... | [
"Return",
"subset",
"of",
"values",
"which",
"match",
"the",
"given",
"text",
"types",
"and",
"/",
"or",
"units",
".",
"For",
"a",
"value",
"to",
"be",
"matched",
"at",
"least",
"one",
"item",
"from",
"each",
"specified",
"filter",
"category",
"has",
"to... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L476-L498 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | PointDataObject.to_dict | def to_dict(self):
"""Converts the set of values into a dictionary. Unset values are excluded."""
return {value.label: value.value for value in self.__values if not value.unset} | python | def to_dict(self):
"""Converts the set of values into a dictionary. Unset values are excluded."""
return {value.label: value.value for value in self.__values if not value.unset} | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"{",
"value",
".",
"label",
":",
"value",
".",
"value",
"for",
"value",
"in",
"self",
".",
"__values",
"if",
"not",
"value",
".",
"unset",
"}"
] | Converts the set of values into a dictionary. Unset values are excluded. | [
"Converts",
"the",
"set",
"of",
"values",
"into",
"a",
"dictionary",
".",
"Unset",
"values",
"are",
"excluded",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L500-L502 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Point.py | PointDataObject._from_dict | def _from_dict(cls, values, value_filter, dictionary, allow_unset=True):
"""Instantiates new PointDataObject, populated from the given dictionary. With allow_unset=False, a ValueError
will be raised if any value has not been set. Used by PointDataObjectHandler"""
if not isinstance(dictionary, Ma... | python | def _from_dict(cls, values, value_filter, dictionary, allow_unset=True):
"""Instantiates new PointDataObject, populated from the given dictionary. With allow_unset=False, a ValueError
will be raised if any value has not been set. Used by PointDataObjectHandler"""
if not isinstance(dictionary, Ma... | [
"def",
"_from_dict",
"(",
"cls",
",",
"values",
",",
"value_filter",
",",
"dictionary",
",",
"allow_unset",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"dictionary",
",",
"Mapping",
")",
":",
"raise",
"TypeError",
"(",
"'dictionary should be mapping... | Instantiates new PointDataObject, populated from the given dictionary. With allow_unset=False, a ValueError
will be raised if any value has not been set. Used by PointDataObjectHandler | [
"Instantiates",
"new",
"PointDataObject",
"populated",
"from",
"the",
"given",
"dictionary",
".",
"With",
"allow_unset",
"=",
"False",
"a",
"ValueError",
"will",
"be",
"raised",
"if",
"any",
"value",
"has",
"not",
"been",
"set",
".",
"Used",
"by",
"PointDataOb... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L505-L518 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/ResourceMeta.py | ResourceMeta.set | def set(self):
"""Pushes the RDF metadata description back to the infrastructure. This will be searchable if you have called
[set_public()](./Thing.m.html#IoticAgent.IOT.Thing.Thing.set_public)
at any time
`Example 1` Use of python `with` syntax and XXXXmeta class. `Recommended`
... | python | def set(self):
"""Pushes the RDF metadata description back to the infrastructure. This will be searchable if you have called
[set_public()](./Thing.m.html#IoticAgent.IOT.Thing.Thing.set_public)
at any time
`Example 1` Use of python `with` syntax and XXXXmeta class. `Recommended`
... | [
"def",
"set",
"(",
"self",
")",
":",
"self",
".",
"__parent",
".",
"set_meta_rdf",
"(",
"self",
".",
"_graph",
".",
"serialize",
"(",
"format",
"=",
"self",
".",
"__fmt",
")",
".",
"decode",
"(",
"'utf8'",
")",
",",
"fmt",
"=",
"self",
".",
"__fmt"... | Pushes the RDF metadata description back to the infrastructure. This will be searchable if you have called
[set_public()](./Thing.m.html#IoticAgent.IOT.Thing.Thing.set_public)
at any time
`Example 1` Use of python `with` syntax and XXXXmeta class. `Recommended`
#!python
... | [
"Pushes",
"the",
"RDF",
"metadata",
"description",
"back",
"to",
"the",
"infrastructure",
".",
"This",
"will",
"be",
"searchable",
"if",
"you",
"have",
"called",
"[",
"set_public",
"()",
"]",
"(",
".",
"/",
"Thing",
".",
"m",
".",
"html#IoticAgent",
".",
... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/ResourceMeta.py#L95-L131 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/ResourceMeta.py | ResourceMeta.update | def update(self):
"""Gets the latest version of your metadata from the infrastructure and updates your local copy
Returns `True` if successful, `False` otherwise - OR -
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrast... | python | def update(self):
"""Gets the latest version of your metadata from the infrastructure and updates your local copy
Returns `True` if successful, `False` otherwise - OR -
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrast... | [
"def",
"update",
"(",
"self",
")",
":",
"graph",
"=",
"Graph",
"(",
")",
"graph",
".",
"parse",
"(",
"data",
"=",
"self",
".",
"__parent",
".",
"get_meta_rdf",
"(",
"fmt",
"=",
"self",
".",
"__fmt",
")",
",",
"format",
"=",
"self",
".",
"__fmt",
... | Gets the latest version of your metadata from the infrastructure and updates your local copy
Returns `True` if successful, `False` otherwise - OR -
Raises [IOTException](./Exceptions.m.html#IoticAgent.IOT.Exceptions.IOTException)
containing the error if the infrastructure detects a problem
... | [
"Gets",
"the",
"latest",
"version",
"of",
"your",
"metadata",
"from",
"the",
"infrastructure",
"and",
"updates",
"your",
"local",
"copy"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/ResourceMeta.py#L133-L146 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/ResourceMeta.py | ResourceMeta.set_label | def set_label(self, label, lang=None):
"""Sets the `label` metadata property on your Thing/Point. Only one label is allowed per language, so any
other labels in this language are removed before adding this one
Raises `ValueError` containing an error message if the parameters fail validation
... | python | def set_label(self, label, lang=None):
"""Sets the `label` metadata property on your Thing/Point. Only one label is allowed per language, so any
other labels in this language are removed before adding this one
Raises `ValueError` containing an error message if the parameters fail validation
... | [
"def",
"set_label",
"(",
"self",
",",
"label",
",",
"lang",
"=",
"None",
")",
":",
"label",
"=",
"Validation",
".",
"label_check_convert",
"(",
"label",
")",
"lang",
"=",
"Validation",
".",
"lang_check_convert",
"(",
"lang",
",",
"default",
"=",
"self",
... | Sets the `label` metadata property on your Thing/Point. Only one label is allowed per language, so any
other labels in this language are removed before adding this one
Raises `ValueError` containing an error message if the parameters fail validation
`label` (mandatory) (string) the new text o... | [
"Sets",
"the",
"label",
"metadata",
"property",
"on",
"your",
"Thing",
"/",
"Point",
".",
"Only",
"one",
"label",
"is",
"allowed",
"per",
"language",
"so",
"any",
"other",
"labels",
"in",
"this",
"language",
"are",
"removed",
"before",
"adding",
"this",
"o... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/ResourceMeta.py#L148-L165 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/ResourceMeta.py | ResourceMeta.delete_label | def delete_label(self, lang=None):
"""Deletes all the `label` metadata properties on your Thing/Point for this language
Raises `ValueError` containing an error message if the parameters fail validation
`lang` (optional) (string) The two-character ISO 639-1 language code to identify your label.... | python | def delete_label(self, lang=None):
"""Deletes all the `label` metadata properties on your Thing/Point for this language
Raises `ValueError` containing an error message if the parameters fail validation
`lang` (optional) (string) The two-character ISO 639-1 language code to identify your label.... | [
"def",
"delete_label",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"self",
".",
"_remove_properties_by_language",
"(",
"self",
".",
"_labelPredicate",
",",
"Validation",
".",
"lang_check_convert",
"(",
"lang",
",",
"default",
"=",
"self",
".",
"_default_l... | Deletes all the `label` metadata properties on your Thing/Point for this language
Raises `ValueError` containing an error message if the parameters fail validation
`lang` (optional) (string) The two-character ISO 639-1 language code to identify your label.
None means use the default language f... | [
"Deletes",
"all",
"the",
"label",
"metadata",
"properties",
"on",
"your",
"Thing",
"/",
"Point",
"for",
"this",
"language"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/ResourceMeta.py#L184-L194 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/ResourceMeta.py | ResourceMeta.set_description | def set_description(self, description, lang=None):
"""Sets the `description` metadata property on your Thing/Point. Only one description is allowed per language,
so any other descriptions in this language are removed before adding this one
Raises `ValueError` containing an error message if the... | python | def set_description(self, description, lang=None):
"""Sets the `description` metadata property on your Thing/Point. Only one description is allowed per language,
so any other descriptions in this language are removed before adding this one
Raises `ValueError` containing an error message if the... | [
"def",
"set_description",
"(",
"self",
",",
"description",
",",
"lang",
"=",
"None",
")",
":",
"description",
"=",
"Validation",
".",
"description_check_convert",
"(",
"description",
")",
"lang",
"=",
"Validation",
".",
"lang_check_convert",
"(",
"lang",
",",
... | Sets the `description` metadata property on your Thing/Point. Only one description is allowed per language,
so any other descriptions in this language are removed before adding this one
Raises `ValueError` containing an error message if the parameters fail validation
`description` (mandatory)... | [
"Sets",
"the",
"description",
"metadata",
"property",
"on",
"your",
"Thing",
"/",
"Point",
".",
"Only",
"one",
"description",
"is",
"allowed",
"per",
"language",
"so",
"any",
"other",
"descriptions",
"in",
"this",
"language",
"are",
"removed",
"before",
"addin... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/ResourceMeta.py#L196-L213 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/ResourceMeta.py | ResourceMeta.delete_description | def delete_description(self, lang=None):
"""Deletes all the `label` metadata properties on your Thing/Point for this language
Raises `ValueError` containing an error message if the parameters fail validation
`lang` (optional) (string) The two-character ISO 639-1 language code to use for your l... | python | def delete_description(self, lang=None):
"""Deletes all the `label` metadata properties on your Thing/Point for this language
Raises `ValueError` containing an error message if the parameters fail validation
`lang` (optional) (string) The two-character ISO 639-1 language code to use for your l... | [
"def",
"delete_description",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"self",
".",
"_remove_properties_by_language",
"(",
"self",
".",
"_commentPredicate",
",",
"Validation",
".",
"lang_check_convert",
"(",
"lang",
",",
"default",
"=",
"self",
".",
"_d... | Deletes all the `label` metadata properties on your Thing/Point for this language
Raises `ValueError` containing an error message if the parameters fail validation
`lang` (optional) (string) The two-character ISO 639-1 language code to use for your label.
None means use the default language fo... | [
"Deletes",
"all",
"the",
"label",
"metadata",
"properties",
"on",
"your",
"Thing",
"/",
"Point",
"for",
"this",
"language"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/ResourceMeta.py#L231-L241 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/utils.py | bool_from | def bool_from(obj, default=False):
"""Returns True if obj is not None and its string representation is not 0 or False (case-insensitive). If obj is
None, 'default' is used.
"""
return str(obj).lower() not in ('0', 'false') if obj is not None else bool(default) | python | def bool_from(obj, default=False):
"""Returns True if obj is not None and its string representation is not 0 or False (case-insensitive). If obj is
None, 'default' is used.
"""
return str(obj).lower() not in ('0', 'false') if obj is not None else bool(default) | [
"def",
"bool_from",
"(",
"obj",
",",
"default",
"=",
"False",
")",
":",
"return",
"str",
"(",
"obj",
")",
".",
"lower",
"(",
")",
"not",
"in",
"(",
"'0'",
",",
"'false'",
")",
"if",
"obj",
"is",
"not",
"None",
"else",
"bool",
"(",
"default",
")"
... | Returns True if obj is not None and its string representation is not 0 or False (case-insensitive). If obj is
None, 'default' is used. | [
"Returns",
"True",
"if",
"obj",
"is",
"not",
"None",
"and",
"its",
"string",
"representation",
"is",
"not",
"0",
"or",
"False",
"(",
"case",
"-",
"insensitive",
")",
".",
"If",
"obj",
"is",
"None",
"default",
"is",
"used",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/utils.py#L66-L70 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/utils.py | private_name_for | def private_name_for(var_name, cls):
"""Returns mangled variable name (if applicable) for the given variable and class instance.
See https://docs.python.org/3/tutorial/classes.html#private-variables"""
if not (isinstance(var_name, string_types) and var_name):
raise TypeError('var_name must be non... | python | def private_name_for(var_name, cls):
"""Returns mangled variable name (if applicable) for the given variable and class instance.
See https://docs.python.org/3/tutorial/classes.html#private-variables"""
if not (isinstance(var_name, string_types) and var_name):
raise TypeError('var_name must be non... | [
"def",
"private_name_for",
"(",
"var_name",
",",
"cls",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"var_name",
",",
"string_types",
")",
"and",
"var_name",
")",
":",
"raise",
"TypeError",
"(",
"'var_name must be non-empty string'",
")",
"if",
"not",
"(",
... | Returns mangled variable name (if applicable) for the given variable and class instance.
See https://docs.python.org/3/tutorial/classes.html#private-variables | [
"Returns",
"mangled",
"variable",
"name",
"(",
"if",
"applicable",
")",
"for",
"the",
"given",
"variable",
"and",
"class",
"instance",
".",
"See",
"https",
":",
"//",
"docs",
".",
"python",
".",
"org",
"/",
"3",
"/",
"tutorial",
"/",
"classes",
".",
"h... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/utils.py#L73-L84 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/utils.py | private_names_for | def private_names_for(cls, names):
"""Returns iterable of private names using privateNameFor()"""
if not isinstance(names, Iterable):
raise TypeError('names must be an interable')
return (private_name_for(item, cls) for item in names) | python | def private_names_for(cls, names):
"""Returns iterable of private names using privateNameFor()"""
if not isinstance(names, Iterable):
raise TypeError('names must be an interable')
return (private_name_for(item, cls) for item in names) | [
"def",
"private_names_for",
"(",
"cls",
",",
"names",
")",
":",
"if",
"not",
"isinstance",
"(",
"names",
",",
"Iterable",
")",
":",
"raise",
"TypeError",
"(",
"'names must be an interable'",
")",
"return",
"(",
"private_name_for",
"(",
"item",
",",
"cls",
")... | Returns iterable of private names using privateNameFor() | [
"Returns",
"iterable",
"of",
"private",
"names",
"using",
"privateNameFor",
"()"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/utils.py#L87-L91 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/compat/thread_utils.py | _InterruptableLock.acquire | def acquire(self, blocking=True, timeout=-1):
"""Acquire a lock, blocking or non-blocking.
Blocks until timeout, if timeout a positive float and blocking=True. A timeout
value of -1 blocks indefinitely, unless blocking=False."""
if not isinstance(timeout, (int, float)):
raise... | python | def acquire(self, blocking=True, timeout=-1):
"""Acquire a lock, blocking or non-blocking.
Blocks until timeout, if timeout a positive float and blocking=True. A timeout
value of -1 blocks indefinitely, unless blocking=False."""
if not isinstance(timeout, (int, float)):
raise... | [
"def",
"acquire",
"(",
"self",
",",
"blocking",
"=",
"True",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"not",
"isinstance",
"(",
"timeout",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"raise",
"TypeError",
"(",
"'a float is required'",
")",
"i... | Acquire a lock, blocking or non-blocking.
Blocks until timeout, if timeout a positive float and blocking=True. A timeout
value of -1 blocks indefinitely, unless blocking=False. | [
"Acquire",
"a",
"lock",
"blocking",
"or",
"non",
"-",
"blocking",
".",
"Blocks",
"until",
"timeout",
"if",
"timeout",
"a",
"positive",
"float",
"and",
"blocking",
"=",
"True",
".",
"A",
"timeout",
"value",
"of",
"-",
"1",
"blocks",
"indefinitely",
"unless"... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/compat/thread_utils.py#L34-L75 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/compat/thread_utils.py | _InterruptableLock.release | def release(self):
"""Release a lock."""
self.__lock.release()
with self.__condition:
self.__condition.notify() | python | def release(self):
"""Release a lock."""
self.__lock.release()
with self.__condition:
self.__condition.notify() | [
"def",
"release",
"(",
"self",
")",
":",
"self",
".",
"__lock",
".",
"release",
"(",
")",
"with",
"self",
".",
"__condition",
":",
"self",
".",
"__condition",
".",
"notify",
"(",
")"
] | Release a lock. | [
"Release",
"a",
"lock",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/compat/thread_utils.py#L77-L81 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_consumer.py | ToolConsumer.set_config | def set_config(self, config):
'''
Set launch data from a ToolConfig.
'''
if self.launch_url == None:
self.launch_url = config.launch_url
self.custom_params.update(config.custom_params) | python | def set_config(self, config):
'''
Set launch data from a ToolConfig.
'''
if self.launch_url == None:
self.launch_url = config.launch_url
self.custom_params.update(config.custom_params) | [
"def",
"set_config",
"(",
"self",
",",
"config",
")",
":",
"if",
"self",
".",
"launch_url",
"==",
"None",
":",
"self",
".",
"launch_url",
"=",
"config",
".",
"launch_url",
"self",
".",
"custom_params",
".",
"update",
"(",
"config",
".",
"custom_params",
... | Set launch data from a ToolConfig. | [
"Set",
"launch",
"data",
"from",
"a",
"ToolConfig",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_consumer.py#L38-L44 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_consumer.py | ToolConsumer.has_required_params | def has_required_params(self):
'''
Check if required parameters for a tool launch are set.
'''
return self.consumer_key and\
self.consumer_secret and\
self.resource_link_id and\
self.launch_url | python | def has_required_params(self):
'''
Check if required parameters for a tool launch are set.
'''
return self.consumer_key and\
self.consumer_secret and\
self.resource_link_id and\
self.launch_url | [
"def",
"has_required_params",
"(",
"self",
")",
":",
"return",
"self",
".",
"consumer_key",
"and",
"self",
".",
"consumer_secret",
"and",
"self",
".",
"resource_link_id",
"and",
"self",
".",
"launch_url"
] | Check if required parameters for a tool launch are set. | [
"Check",
"if",
"required",
"parameters",
"for",
"a",
"tool",
"launch",
"are",
"set",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_consumer.py#L46-L53 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/RequestEvent.py | RequestEvent._sent_without_response | def _sent_without_response(self, send_time_before):
"""Used internally to determine whether the request has not received any response from the container and was
send before the given time. Unsent requests are not considered."""
return not self._messages and self._send_time and self._send_time... | python | def _sent_without_response(self, send_time_before):
"""Used internally to determine whether the request has not received any response from the container and was
send before the given time. Unsent requests are not considered."""
return not self._messages and self._send_time and self._send_time... | [
"def",
"_sent_without_response",
"(",
"self",
",",
"send_time_before",
")",
":",
"return",
"not",
"self",
".",
"_messages",
"and",
"self",
".",
"_send_time",
"and",
"self",
".",
"_send_time",
"<",
"send_time_before"
] | Used internally to determine whether the request has not received any response from the container and was
send before the given time. Unsent requests are not considered. | [
"Used",
"internally",
"to",
"determine",
"whether",
"the",
"request",
"has",
"not",
"received",
"any",
"response",
"from",
"the",
"container",
"and",
"was",
"send",
"before",
"the",
"given",
"time",
".",
"Unsent",
"requests",
"are",
"not",
"considered",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L62-L65 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/RequestEvent.py | RequestEvent.is_set | def is_set(self):
"""Returns True if the request has finished or False if it is still pending.
Raises [LinkException](AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException) if the request failed due to a
network related problem.
"""
if self.__event.is_set():
if self... | python | def is_set(self):
"""Returns True if the request has finished or False if it is still pending.
Raises [LinkException](AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException) if the request failed due to a
network related problem.
"""
if self.__event.is_set():
if self... | [
"def",
"is_set",
"(",
"self",
")",
":",
"if",
"self",
".",
"__event",
".",
"is_set",
"(",
")",
":",
"if",
"self",
".",
"exception",
"is",
"not",
"None",
":",
"# todo better way to raise errors on behalf of other Threads?",
"raise",
"self",
".",
"exception",
"#... | Returns True if the request has finished or False if it is still pending.
Raises [LinkException](AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException) if the request failed due to a
network related problem. | [
"Returns",
"True",
"if",
"the",
"request",
"has",
"finished",
"or",
"False",
"if",
"it",
"is",
"still",
"pending",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L67-L78 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/RequestEvent.py | RequestEvent._set | def _set(self):
"""Called internally by Client to indicate this request has finished"""
self.__event.set()
if self._complete_func:
self.__run_completion_func(self._complete_func, self.id_) | python | def _set(self):
"""Called internally by Client to indicate this request has finished"""
self.__event.set()
if self._complete_func:
self.__run_completion_func(self._complete_func, self.id_) | [
"def",
"_set",
"(",
"self",
")",
":",
"self",
".",
"__event",
".",
"set",
"(",
")",
"if",
"self",
".",
"_complete_func",
":",
"self",
".",
"__run_completion_func",
"(",
"self",
".",
"_complete_func",
",",
"self",
".",
"id_",
")"
] | Called internally by Client to indicate this request has finished | [
"Called",
"internally",
"by",
"Client",
"to",
"indicate",
"this",
"request",
"has",
"finished"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L80-L84 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/RequestEvent.py | RequestEvent._run_on_completion | def _run_on_completion(self, func, *args, **kwargs):
"""Function to call when request has finished, after having been _set(). The first argument passed to func will
be the request itself. Additional parameters are NOT validated. If the request is already finished, the given
function will be run ... | python | def _run_on_completion(self, func, *args, **kwargs):
"""Function to call when request has finished, after having been _set(). The first argument passed to func will
be the request itself. Additional parameters are NOT validated. If the request is already finished, the given
function will be run ... | [
"def",
"_run_on_completion",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_complete_func",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"'Completion function already set for %s: %s'",
"%",
"(",
"... | Function to call when request has finished, after having been _set(). The first argument passed to func will
be the request itself. Additional parameters are NOT validated. If the request is already finished, the given
function will be run immediately (in same thread). | [
"Function",
"to",
"call",
"when",
"request",
"has",
"finished",
"after",
"having",
"been",
"_set",
"()",
".",
"The",
"first",
"argument",
"passed",
"to",
"func",
"will",
"be",
"the",
"request",
"itself",
".",
"Additional",
"parameters",
"are",
"NOT",
"valida... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L94-L105 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/RequestEvent.py | RequestEvent.wait | def wait(self, timeout=None):
"""Wait for the request to finish, optionally timing out. Returns True if the request has finished or False if
it is still pending.
Raises [LinkException](AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException) if the request failed due to a
network related... | python | def wait(self, timeout=None):
"""Wait for the request to finish, optionally timing out. Returns True if the request has finished or False if
it is still pending.
Raises [LinkException](AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException) if the request failed due to a
network related... | [
"def",
"wait",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"self",
".",
"__event",
".",
"wait",
"(",
"timeout",
")",
":",
"if",
"self",
".",
"exception",
"is",
"not",
"None",
":",
"# todo better way to raise errors on behalf of other Threads?",
... | Wait for the request to finish, optionally timing out. Returns True if the request has finished or False if
it is still pending.
Raises [LinkException](AmqpLink.m.html#IoticAgent.Core.AmqpLink.LinkException) if the request failed due to a
network related problem. | [
"Wait",
"for",
"the",
"request",
"to",
"finish",
"optionally",
"timing",
"out",
".",
"Returns",
"True",
"if",
"the",
"request",
"has",
"finished",
"or",
"False",
"if",
"it",
"is",
"still",
"pending",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L107-L119 |
edx/edx-django-utils | edx_django_utils/private_utils.py | _check_middleware_dependencies | def _check_middleware_dependencies(concerned_object, required_middleware):
"""
Check required middleware dependencies exist and in the correct order.
Args:
concerned_object (object): The object for which the required
middleware is being checked. This is used for error messages only.
... | python | def _check_middleware_dependencies(concerned_object, required_middleware):
"""
Check required middleware dependencies exist and in the correct order.
Args:
concerned_object (object): The object for which the required
middleware is being checked. This is used for error messages only.
... | [
"def",
"_check_middleware_dependencies",
"(",
"concerned_object",
",",
"required_middleware",
")",
":",
"declared_middleware",
"=",
"getattr",
"(",
"settings",
",",
"'MIDDLEWARE'",
",",
"None",
")",
"if",
"declared_middleware",
"is",
"None",
":",
"declared_middleware",
... | Check required middleware dependencies exist and in the correct order.
Args:
concerned_object (object): The object for which the required
middleware is being checked. This is used for error messages only.
required_middleware (list of String): An ordered list representing the
... | [
"Check",
"required",
"middleware",
"dependencies",
"exist",
"and",
"in",
"the",
"correct",
"order",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/private_utils.py#L12-L48 |
tophatmonocle/ims_lti_py | ims_lti_py/request_validator.py | RequestValidatorMixin.is_valid_request | def is_valid_request(self, request, parameters={},
fake_method=None, handle_error=True):
'''
Validates an OAuth request using the python-oauth2 library:
https://github.com/simplegeo/python-oauth2
'''
try:
# Set the parameters to be what w... | python | def is_valid_request(self, request, parameters={},
fake_method=None, handle_error=True):
'''
Validates an OAuth request using the python-oauth2 library:
https://github.com/simplegeo/python-oauth2
'''
try:
# Set the parameters to be what w... | [
"def",
"is_valid_request",
"(",
"self",
",",
"request",
",",
"parameters",
"=",
"{",
"}",
",",
"fake_method",
"=",
"None",
",",
"handle_error",
"=",
"True",
")",
":",
"try",
":",
"# Set the parameters to be what we were passed earlier",
"# if we didn't get any passed ... | Validates an OAuth request using the python-oauth2 library:
https://github.com/simplegeo/python-oauth2 | [
"Validates",
"an",
"OAuth",
"request",
"using",
"the",
"python",
"-",
"oauth2",
"library",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"simplegeo",
"/",
"python",
"-",
"oauth2"
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/request_validator.py#L17-L48 |
tophatmonocle/ims_lti_py | ims_lti_py/request_validator.py | FlaskRequestValidatorMixin.parse_request | def parse_request(self, request, parameters=None, fake_method=None):
'''
Parse Flask request
'''
return (request.method,
request.url,
request.headers,
request.form.copy()) | python | def parse_request(self, request, parameters=None, fake_method=None):
'''
Parse Flask request
'''
return (request.method,
request.url,
request.headers,
request.form.copy()) | [
"def",
"parse_request",
"(",
"self",
",",
"request",
",",
"parameters",
"=",
"None",
",",
"fake_method",
"=",
"None",
")",
":",
"return",
"(",
"request",
".",
"method",
",",
"request",
".",
"url",
",",
"request",
".",
"headers",
",",
"request",
".",
"f... | Parse Flask request | [
"Parse",
"Flask",
"request"
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/request_validator.py#L74-L81 |
tophatmonocle/ims_lti_py | ims_lti_py/request_validator.py | DjangoRequestValidatorMixin.parse_request | def parse_request(self, request, parameters, fake_method=None):
'''
Parse Django request
'''
return (fake_method or request.method,
request.build_absolute_uri(),
request.META,
(dict(request.POST.iteritems())
if request.m... | python | def parse_request(self, request, parameters, fake_method=None):
'''
Parse Django request
'''
return (fake_method or request.method,
request.build_absolute_uri(),
request.META,
(dict(request.POST.iteritems())
if request.m... | [
"def",
"parse_request",
"(",
"self",
",",
"request",
",",
"parameters",
",",
"fake_method",
"=",
"None",
")",
":",
"return",
"(",
"fake_method",
"or",
"request",
".",
"method",
",",
"request",
".",
"build_absolute_uri",
"(",
")",
",",
"request",
".",
"META... | Parse Django request | [
"Parse",
"Django",
"request"
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/request_validator.py#L89-L98 |
tophatmonocle/ims_lti_py | ims_lti_py/request_validator.py | WebObRequestValidatorMixin.parse_request | def parse_request(self, request, parameters=None, fake_method=None):
'''
Parse WebOb request
'''
return (request.method,
request.url,
request.headers,
request.POST.mixed()) | python | def parse_request(self, request, parameters=None, fake_method=None):
'''
Parse WebOb request
'''
return (request.method,
request.url,
request.headers,
request.POST.mixed()) | [
"def",
"parse_request",
"(",
"self",
",",
"request",
",",
"parameters",
"=",
"None",
",",
"fake_method",
"=",
"None",
")",
":",
"return",
"(",
"request",
".",
"method",
",",
"request",
".",
"url",
",",
"request",
".",
"headers",
",",
"request",
".",
"P... | Parse WebOb request | [
"Parse",
"WebOb",
"request"
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/request_validator.py#L105-L112 |
tophatmonocle/ims_lti_py | ims_lti_py/outcome_response.py | OutcomeResponse.from_post_response | def from_post_response(post_response, content):
'''
Convenience method for creating a new OutcomeResponse from a response
object.
'''
response = OutcomeResponse()
response.post_response = post_response
response.response_code = post_response.status
response... | python | def from_post_response(post_response, content):
'''
Convenience method for creating a new OutcomeResponse from a response
object.
'''
response = OutcomeResponse()
response.post_response = post_response
response.response_code = post_response.status
response... | [
"def",
"from_post_response",
"(",
"post_response",
",",
"content",
")",
":",
"response",
"=",
"OutcomeResponse",
"(",
")",
"response",
".",
"post_response",
"=",
"post_response",
"response",
".",
"response_code",
"=",
"post_response",
".",
"status",
"response",
".... | Convenience method for creating a new OutcomeResponse from a response
object. | [
"Convenience",
"method",
"for",
"creating",
"a",
"new",
"OutcomeResponse",
"from",
"a",
"response",
"object",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/outcome_response.py#L55-L64 |
tophatmonocle/ims_lti_py | ims_lti_py/outcome_response.py | OutcomeResponse.process_xml | def process_xml(self, xml):
'''
Parse OutcomeResponse data form XML.
'''
try:
root = objectify.fromstring(xml)
# Get message idenifier from header info
self.message_identifier = root.imsx_POXHeader.\
imsx_POXResponseHeaderInfo.\
... | python | def process_xml(self, xml):
'''
Parse OutcomeResponse data form XML.
'''
try:
root = objectify.fromstring(xml)
# Get message idenifier from header info
self.message_identifier = root.imsx_POXHeader.\
imsx_POXResponseHeaderInfo.\
... | [
"def",
"process_xml",
"(",
"self",
",",
"xml",
")",
":",
"try",
":",
"root",
"=",
"objectify",
".",
"fromstring",
"(",
"xml",
")",
"# Get message idenifier from header info",
"self",
".",
"message_identifier",
"=",
"root",
".",
"imsx_POXHeader",
".",
"imsx_POXRe... | Parse OutcomeResponse data form XML. | [
"Parse",
"OutcomeResponse",
"data",
"form",
"XML",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/outcome_response.py#L84-L115 |
tophatmonocle/ims_lti_py | ims_lti_py/outcome_response.py | OutcomeResponse.generate_response_xml | def generate_response_xml(self):
'''
Generate XML based on the current configuration.
'''
root = etree.Element(
'imsx_POXEnvelopeResponse',
xmlns='http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0')
header = etree.SubElement(root, 'imsx_POXHeader'... | python | def generate_response_xml(self):
'''
Generate XML based on the current configuration.
'''
root = etree.Element(
'imsx_POXEnvelopeResponse',
xmlns='http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0')
header = etree.SubElement(root, 'imsx_POXHeader'... | [
"def",
"generate_response_xml",
"(",
"self",
")",
":",
"root",
"=",
"etree",
".",
"Element",
"(",
"'imsx_POXEnvelopeResponse'",
",",
"xmlns",
"=",
"'http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0'",
")",
"header",
"=",
"etree",
".",
"SubElement",
"(",
"root... | Generate XML based on the current configuration. | [
"Generate",
"XML",
"based",
"on",
"the",
"current",
"configuration",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/outcome_response.py#L117-L160 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/Core/Profiler.py | profiled_thread | def profiled_thread(func):
"""decorator to profile a thread or function. Profiling output will be written to
'agent_profile_<process_id>.<thread_id_>.<thread_name>.log'"""
def wrapper(*args, **kwargs):
profile = Profile()
profile.enable()
try:
func(*args, **kwargs)
... | python | def profiled_thread(func):
"""decorator to profile a thread or function. Profiling output will be written to
'agent_profile_<process_id>.<thread_id_>.<thread_name>.log'"""
def wrapper(*args, **kwargs):
profile = Profile()
profile.enable()
try:
func(*args, **kwargs)
... | [
"def",
"profiled_thread",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"profile",
"=",
"Profile",
"(",
")",
"profile",
".",
"enable",
"(",
")",
"try",
":",
"func",
"(",
"*",
"args",
",",
"*",
"*",
... | decorator to profile a thread or function. Profiling output will be written to
'agent_profile_<process_id>.<thread_id_>.<thread_name>.log | [
"decorator",
"to",
"profile",
"a",
"thread",
"or",
"function",
".",
"Profiling",
"output",
"will",
"be",
"written",
"to",
"agent_profile_<process_id",
">",
".",
"<thread_id_",
">",
".",
"<thread_name",
">",
".",
"log"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Profiler.py#L66-L83 |
HumanCellAtlas/dcplib | dcplib/media_types/media_type.py | MediaType._minimally_quoted_parameter_value | def _minimally_quoted_parameter_value(value):
"""
Per RFC 7321 (https://tools.ietf.org/html/rfc7231#section-3.1.1.1):
Parameters values don't need to be quoted if they are a "token".
Token characters are defined by RFC 7320 (https://tools.ietf.org/html/rfc7230#section-3.2.6).
Oth... | python | def _minimally_quoted_parameter_value(value):
"""
Per RFC 7321 (https://tools.ietf.org/html/rfc7231#section-3.1.1.1):
Parameters values don't need to be quoted if they are a "token".
Token characters are defined by RFC 7320 (https://tools.ietf.org/html/rfc7230#section-3.2.6).
Oth... | [
"def",
"_minimally_quoted_parameter_value",
"(",
"value",
")",
":",
"if",
"re",
".",
"match",
"(",
"\"^[{charset}]*$\"",
".",
"format",
"(",
"charset",
"=",
"MediaType",
".",
"RFC7320_TOKEN_CHARSET",
")",
",",
"value",
")",
":",
"return",
"value",
"else",
":",... | Per RFC 7321 (https://tools.ietf.org/html/rfc7231#section-3.1.1.1):
Parameters values don't need to be quoted if they are a "token".
Token characters are defined by RFC 7320 (https://tools.ietf.org/html/rfc7230#section-3.2.6).
Otherwise, parameters values can be a "quoted-string".
So we ... | [
"Per",
"RFC",
"7321",
"(",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc7231#section",
"-",
"3",
".",
"1",
".",
"1",
".",
"1",
")",
":",
"Parameters",
"values",
"don",
"t",
"need",
"to",
"be",
"quoted",
"if",
"they"... | train | https://github.com/HumanCellAtlas/dcplib/blob/23614d39914a6b5fc278e732030674a2956a0767/dcplib/media_types/media_type.py#L118-L129 |
edx/edx-django-utils | edx_django_utils/monitoring/utils.py | set_custom_metrics_for_course_key | def set_custom_metrics_for_course_key(course_key):
"""
Set monitoring custom metrics related to a course key.
This is not cached, and only support reporting to New Relic Insights.
"""
if not newrelic:
return
newrelic.agent.add_custom_parameter('course_id', six.text_type(course_key))
... | python | def set_custom_metrics_for_course_key(course_key):
"""
Set monitoring custom metrics related to a course key.
This is not cached, and only support reporting to New Relic Insights.
"""
if not newrelic:
return
newrelic.agent.add_custom_parameter('course_id', six.text_type(course_key))
... | [
"def",
"set_custom_metrics_for_course_key",
"(",
"course_key",
")",
":",
"if",
"not",
"newrelic",
":",
"return",
"newrelic",
".",
"agent",
".",
"add_custom_parameter",
"(",
"'course_id'",
",",
"six",
".",
"text_type",
"(",
"course_key",
")",
")",
"newrelic",
"."... | Set monitoring custom metrics related to a course key.
This is not cached, and only support reporting to New Relic Insights. | [
"Set",
"monitoring",
"custom",
"metrics",
"related",
"to",
"a",
"course",
"key",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/utils.py#L65-L75 |
edx/edx-django-utils | edx_django_utils/monitoring/utils.py | set_monitoring_transaction_name | def set_monitoring_transaction_name(name, group=None, priority=None):
"""
Sets the transaction name for monitoring.
This is not cached, and only support reporting to New Relic.
"""
if not newrelic:
return
newrelic.agent.set_transaction_name(name, group, priority) | python | def set_monitoring_transaction_name(name, group=None, priority=None):
"""
Sets the transaction name for monitoring.
This is not cached, and only support reporting to New Relic.
"""
if not newrelic:
return
newrelic.agent.set_transaction_name(name, group, priority) | [
"def",
"set_monitoring_transaction_name",
"(",
"name",
",",
"group",
"=",
"None",
",",
"priority",
"=",
"None",
")",
":",
"if",
"not",
"newrelic",
":",
"return",
"newrelic",
".",
"agent",
".",
"set_transaction_name",
"(",
"name",
",",
"group",
",",
"priority... | Sets the transaction name for monitoring.
This is not cached, and only support reporting to New Relic. | [
"Sets",
"the",
"transaction",
"name",
"for",
"monitoring",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/utils.py#L90-L99 |
edx/edx-django-utils | edx_django_utils/monitoring/utils.py | function_trace | def function_trace(function_name):
"""
Wraps a chunk of code that we want to appear as a separate, explicit,
segment in our monitoring tools.
"""
if newrelic:
nr_transaction = newrelic.agent.current_transaction()
with newrelic.agent.FunctionTrace(nr_transaction, function_name):
... | python | def function_trace(function_name):
"""
Wraps a chunk of code that we want to appear as a separate, explicit,
segment in our monitoring tools.
"""
if newrelic:
nr_transaction = newrelic.agent.current_transaction()
with newrelic.agent.FunctionTrace(nr_transaction, function_name):
... | [
"def",
"function_trace",
"(",
"function_name",
")",
":",
"if",
"newrelic",
":",
"nr_transaction",
"=",
"newrelic",
".",
"agent",
".",
"current_transaction",
"(",
")",
"with",
"newrelic",
".",
"agent",
".",
"FunctionTrace",
"(",
"nr_transaction",
",",
"function_n... | Wraps a chunk of code that we want to appear as a separate, explicit,
segment in our monitoring tools. | [
"Wraps",
"a",
"chunk",
"of",
"code",
"that",
"we",
"want",
"to",
"appear",
"as",
"a",
"separate",
"explicit",
"segment",
"in",
"our",
"monitoring",
"tools",
"."
] | train | https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/utils.py#L103-L113 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/third/amqp/connection.py | Connection.channel | def channel(self, channel_id=None, auto_encode_decode=True):
"""Fetch a Channel object identified by the numeric channel_id, or
create that object if it doesn't already exist. See Channel for meaning
of auto_encode_decode. If the channel already exists, the auto_* flag
will not be update... | python | def channel(self, channel_id=None, auto_encode_decode=True):
"""Fetch a Channel object identified by the numeric channel_id, or
create that object if it doesn't already exist. See Channel for meaning
of auto_encode_decode. If the channel already exists, the auto_* flag
will not be update... | [
"def",
"channel",
"(",
"self",
",",
"channel_id",
"=",
"None",
",",
"auto_encode_decode",
"=",
"True",
")",
":",
"try",
":",
"return",
"self",
".",
"channels",
"[",
"channel_id",
"]",
"except",
"KeyError",
":",
"return",
"self",
".",
"Channel",
"(",
"sel... | Fetch a Channel object identified by the numeric channel_id, or
create that object if it doesn't already exist. See Channel for meaning
of auto_encode_decode. If the channel already exists, the auto_* flag
will not be updated. | [
"Fetch",
"a",
"Channel",
"object",
"identified",
"by",
"the",
"numeric",
"channel_id",
"or",
"create",
"that",
"object",
"if",
"it",
"doesn",
"t",
"already",
"exist",
".",
"See",
"Channel",
"for",
"meaning",
"of",
"auto_encode_decode",
".",
"If",
"the",
"cha... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/third/amqp/connection.py#L278-L287 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/third/amqp/connection.py | Connection.drain_events | def drain_events(self, timeout=None):
"""Wait for an event on a channel."""
chanmap = self.channels
chanid, method_sig, args, content = self._wait_multiple(
chanmap, None, timeout=timeout,
)
channel = chanmap[chanid]
if (content and
channel.a... | python | def drain_events(self, timeout=None):
"""Wait for an event on a channel."""
chanmap = self.channels
chanid, method_sig, args, content = self._wait_multiple(
chanmap, None, timeout=timeout,
)
channel = chanmap[chanid]
if (content and
channel.a... | [
"def",
"drain_events",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"chanmap",
"=",
"self",
".",
"channels",
"chanid",
",",
"method_sig",
",",
"args",
",",
"content",
"=",
"self",
".",
"_wait_multiple",
"(",
"chanmap",
",",
"None",
",",
"timeout",... | Wait for an event on a channel. | [
"Wait",
"for",
"an",
"event",
"on",
"a",
"channel",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/third/amqp/connection.py#L304-L331 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/third/amqp/connection.py | Connection.close | def close(self, reply_code=0, reply_text='', method_sig=(0, 0)):
"""Request a connection close
This method indicates that the sender wants to close the
connection. This may be due to internal conditions (e.g. a
forced shut-down) or due to an error handling a specific
method, i.e... | python | def close(self, reply_code=0, reply_text='', method_sig=(0, 0)):
"""Request a connection close
This method indicates that the sender wants to close the
connection. This may be due to internal conditions (e.g. a
forced shut-down) or due to an error handling a specific
method, i.e... | [
"def",
"close",
"(",
"self",
",",
"reply_code",
"=",
"0",
",",
"reply_text",
"=",
"''",
",",
"method_sig",
"=",
"(",
"0",
",",
"0",
")",
")",
":",
"if",
"self",
".",
"transport",
"is",
"None",
":",
"# already closed",
"return",
"args",
"=",
"AMQPWrit... | Request a connection close
This method indicates that the sender wants to close the
connection. This may be due to internal conditions (e.g. a
forced shut-down) or due to an error handling a specific
method, i.e. an exception. When a close is due to an
exception, the sender pro... | [
"Request",
"a",
"connection",
"close"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/third/amqp/connection.py#L404-L481 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/PointValueHelper.py | _ValueFilter.filter_by | def filter_by(self, types=(), units=()):
"""Return list of value labels, filtered by either or both type and unit. An empty
sequence for either argument will match as long as the other argument matches any values."""
if not (isinstance(types, Sequence) and isinstance(units, Sequence)):
... | python | def filter_by(self, types=(), units=()):
"""Return list of value labels, filtered by either or both type and unit. An empty
sequence for either argument will match as long as the other argument matches any values."""
if not (isinstance(types, Sequence) and isinstance(units, Sequence)):
... | [
"def",
"filter_by",
"(",
"self",
",",
"types",
"=",
"(",
")",
",",
"units",
"=",
"(",
")",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"types",
",",
"Sequence",
")",
"and",
"isinstance",
"(",
"units",
",",
"Sequence",
")",
")",
":",
"raise",
"... | Return list of value labels, filtered by either or both type and unit. An empty
sequence for either argument will match as long as the other argument matches any values. | [
"Return",
"list",
"of",
"value",
"labels",
"filtered",
"by",
"either",
"or",
"both",
"type",
"and",
"unit",
".",
"An",
"empty",
"sequence",
"for",
"either",
"argument",
"will",
"match",
"as",
"long",
"as",
"the",
"other",
"argument",
"matches",
"any",
"val... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/PointValueHelper.py#L99-L120 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/PointValueHelper.py | PointDataObjectHandler.get_template | def get_template(self, data=None): # noqa (complexity)
"""Get new template which represents the values of this point in a
[PointDataObject](./Point.m.html#IoticAgent.IOT.Point.PointDataObject). If data is set (to a dictionary), use
this to populate the created template."""
with self.__l... | python | def get_template(self, data=None): # noqa (complexity)
"""Get new template which represents the values of this point in a
[PointDataObject](./Point.m.html#IoticAgent.IOT.Point.PointDataObject). If data is set (to a dictionary), use
this to populate the created template."""
with self.__l... | [
"def",
"get_template",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"# noqa (complexity)",
"with",
"self",
".",
"__lock",
":",
"if",
"self",
".",
"__value_templates",
"is",
"None",
"and",
"self",
".",
"__last_parse_ok",
":",
"try",
":",
"self",
".",
... | Get new template which represents the values of this point in a
[PointDataObject](./Point.m.html#IoticAgent.IOT.Point.PointDataObject). If data is set (to a dictionary), use
this to populate the created template. | [
"Get",
"new",
"template",
"which",
"represents",
"the",
"values",
"of",
"this",
"point",
"in",
"a",
"[",
"PointDataObject",
"]",
"(",
".",
"/",
"Point",
".",
"m",
".",
"html#IoticAgent",
".",
"IOT",
".",
"Point",
".",
"PointDataObject",
")",
".",
"If",
... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/PointValueHelper.py#L157-L191 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/PointValueHelper.py | PointDataObjectHandler.__refresh | def __refresh(self):
"""Update local knowledge of values (to be used to create new skeletal instances). MUST be called within
lock."""
raw_values = self.__get_values()
if not raw_values:
raise RefreshException('Point has no values')
# individual templates
tem... | python | def __refresh(self):
"""Update local knowledge of values (to be used to create new skeletal instances). MUST be called within
lock."""
raw_values = self.__get_values()
if not raw_values:
raise RefreshException('Point has no values')
# individual templates
tem... | [
"def",
"__refresh",
"(",
"self",
")",
":",
"raw_values",
"=",
"self",
".",
"__get_values",
"(",
")",
"if",
"not",
"raw_values",
":",
"raise",
"RefreshException",
"(",
"'Point has no values'",
")",
"# individual templates",
"templates",
"=",
"[",
"]",
"# lookup t... | Update local knowledge of values (to be used to create new skeletal instances). MUST be called within
lock. | [
"Update",
"local",
"knowledge",
"of",
"values",
"(",
"to",
"be",
"used",
"to",
"create",
"new",
"skeletal",
"instances",
")",
".",
"MUST",
"be",
"called",
"within",
"lock",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/PointValueHelper.py#L193-L223 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/PointValueHelper.py | PointDataObjectHandler.__get_values | def __get_values(self):
"""Retrieve value information either via describe or point value listing. MUST be called within lock."""
values = []
if self.__remote:
description = self.__client.describe(self.__point)
if description is not None:
if description['t... | python | def __get_values(self):
"""Retrieve value information either via describe or point value listing. MUST be called within lock."""
values = []
if self.__remote:
description = self.__client.describe(self.__point)
if description is not None:
if description['t... | [
"def",
"__get_values",
"(",
"self",
")",
":",
"values",
"=",
"[",
"]",
"if",
"self",
".",
"__remote",
":",
"description",
"=",
"self",
".",
"__client",
".",
"describe",
"(",
"self",
".",
"__point",
")",
"if",
"description",
"is",
"not",
"None",
":",
... | Retrieve value information either via describe or point value listing. MUST be called within lock. | [
"Retrieve",
"value",
"information",
"either",
"via",
"describe",
"or",
"point",
"value",
"listing",
".",
"MUST",
"be",
"called",
"within",
"lock",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/PointValueHelper.py#L225-L251 |
HumanCellAtlas/dcplib | dcplib/s3_multipart.py | get_s3_multipart_chunk_size | def get_s3_multipart_chunk_size(filesize):
"""Returns the chunk size of the S3 multipart object, given a file's size."""
if filesize <= AWS_MAX_MULTIPART_COUNT * AWS_MIN_CHUNK_SIZE:
return AWS_MIN_CHUNK_SIZE
else:
div = filesize // AWS_MAX_MULTIPART_COUNT
if div * AWS_MAX_MULTIPART_C... | python | def get_s3_multipart_chunk_size(filesize):
"""Returns the chunk size of the S3 multipart object, given a file's size."""
if filesize <= AWS_MAX_MULTIPART_COUNT * AWS_MIN_CHUNK_SIZE:
return AWS_MIN_CHUNK_SIZE
else:
div = filesize // AWS_MAX_MULTIPART_COUNT
if div * AWS_MAX_MULTIPART_C... | [
"def",
"get_s3_multipart_chunk_size",
"(",
"filesize",
")",
":",
"if",
"filesize",
"<=",
"AWS_MAX_MULTIPART_COUNT",
"*",
"AWS_MIN_CHUNK_SIZE",
":",
"return",
"AWS_MIN_CHUNK_SIZE",
"else",
":",
"div",
"=",
"filesize",
"//",
"AWS_MAX_MULTIPART_COUNT",
"if",
"div",
"*",
... | Returns the chunk size of the S3 multipart object, given a file's size. | [
"Returns",
"the",
"chunk",
"size",
"of",
"the",
"S3",
"multipart",
"object",
"given",
"a",
"file",
"s",
"size",
"."
] | train | https://github.com/HumanCellAtlas/dcplib/blob/23614d39914a6b5fc278e732030674a2956a0767/dcplib/s3_multipart.py#L14-L22 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_config.py | ToolConfig.set_ext_param | def set_ext_param(self, ext_key, param_key, val):
'''
Set the provided parameter in a set of extension parameters.
'''
if not self.extensions[ext_key]:
self.extensions[ext_key] = defaultdict(lambda: None)
self.extensions[ext_key][param_key] = val | python | def set_ext_param(self, ext_key, param_key, val):
'''
Set the provided parameter in a set of extension parameters.
'''
if not self.extensions[ext_key]:
self.extensions[ext_key] = defaultdict(lambda: None)
self.extensions[ext_key][param_key] = val | [
"def",
"set_ext_param",
"(",
"self",
",",
"ext_key",
",",
"param_key",
",",
"val",
")",
":",
"if",
"not",
"self",
".",
"extensions",
"[",
"ext_key",
"]",
":",
"self",
".",
"extensions",
"[",
"ext_key",
"]",
"=",
"defaultdict",
"(",
"lambda",
":",
"None... | Set the provided parameter in a set of extension parameters. | [
"Set",
"the",
"provided",
"parameter",
"in",
"a",
"set",
"of",
"extension",
"parameters",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_config.py#L90-L96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.