repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L248-L257
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L298-L306
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Validation.py#L309-L316
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L93-L108
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L110-L125
train
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", ...
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L127-L144
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L146-L164
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L166-L183
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L204-L221
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L223-L251
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L253-L259
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L261-L281
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L283-L299
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L301-L318
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L320-L337
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L432-L445
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L451-L463
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L530-L536
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Thing.py#L671-L702
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L112-L123
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L125-L134
train
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", ...
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L156-L172
train
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", ")", "try", ":", "self", ".", ...
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", "...
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L180-L220
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L86-L100
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L102-L121
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L123-L147
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L149-L161
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L163-L183
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L185-L189
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L210-L227
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L229-L257
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L334-L375
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L383-L403
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L500-L502
train
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...
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Point.py#L505-L518
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/ResourceMeta.py#L133-L146
train
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"...
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/compat/thread_utils.py#L34-L75
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/compat/thread_utils.py#L77-L81
train
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", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_consumer.py#L38-L44
train
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", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_consumer.py#L46-L53
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L62-L65
train
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", ":", "raise", "self", ".", "exception", "return", "True", "return", "False" ]
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L67-L78
train
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" ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L80-L84
train
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", ":", "raise", "self", ".", "exception", "return", "True", "...
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RequestEvent.py#L107-L119
train
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", "." ]
16cb4ac617e53c572bf68ccd19d24afeff1ca769
https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/private_utils.py#L12-L48
train
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" ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/request_validator.py#L74-L81
train
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" ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/request_validator.py#L89-L98
train
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" ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/request_validator.py#L105-L112
train
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", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/outcome_response.py#L55-L64
train
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", ")", "self", ".", "message_identifier", "=", "root", ".", "imsx_POXHeader", ".", "imsx_POXResponseHeaderInfo", ".", "imsx_messageIdent...
Parse OutcomeResponse data form XML.
[ "Parse", "OutcomeResponse", "data", "form", "XML", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/outcome_response.py#L84-L115
train
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", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/outcome_response.py#L117-L160
train
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", "." ]
16cb4ac617e53c572bf68ccd19d24afeff1ca769
https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/utils.py#L65-L75
train
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", "." ]
16cb4ac617e53c572bf68ccd19d24afeff1ca769
https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/utils.py#L90-L99
train
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", "." ]
16cb4ac617e53c572bf68ccd19d24afeff1ca769
https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/utils.py#L103-L113
train
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...
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/PointValueHelper.py#L99-L120
train
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", "." ]
893e8582ad1dacfe32dfc0ee89452bbd6f57d28d
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/PointValueHelper.py#L225-L251
train
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", "." ]
23614d39914a6b5fc278e732030674a2956a0767
https://github.com/HumanCellAtlas/dcplib/blob/23614d39914a6b5fc278e732030674a2956a0767/dcplib/s3_multipart.py#L14-L22
train
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", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_config.py#L90-L96
train
tophatmonocle/ims_lti_py
ims_lti_py/tool_config.py
ToolConfig.get_ext_param
def get_ext_param(self, ext_key, param_key): ''' Get specific param in set of provided extension parameters. ''' return self.extensions[ext_key][param_key] if self.extensions[ext_key]\ else None
python
def get_ext_param(self, ext_key, param_key): ''' Get specific param in set of provided extension parameters. ''' return self.extensions[ext_key][param_key] if self.extensions[ext_key]\ else None
[ "def", "get_ext_param", "(", "self", ",", "ext_key", ",", "param_key", ")", ":", "return", "self", ".", "extensions", "[", "ext_key", "]", "[", "param_key", "]", "if", "self", ".", "extensions", "[", "ext_key", "]", "else", "None" ]
Get specific param in set of provided extension parameters.
[ "Get", "specific", "param", "in", "set", "of", "provided", "extension", "parameters", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_config.py#L98-L103
train
tophatmonocle/ims_lti_py
ims_lti_py/tool_config.py
ToolConfig.process_xml
def process_xml(self, xml): ''' Parse tool configuration data out of the Common Cartridge LTI link XML. ''' root = objectify.fromstring(xml, parser = etree.XMLParser()) # Parse all children of the root node for child in root.getchildren(): if 'title' in child....
python
def process_xml(self, xml): ''' Parse tool configuration data out of the Common Cartridge LTI link XML. ''' root = objectify.fromstring(xml, parser = etree.XMLParser()) # Parse all children of the root node for child in root.getchildren(): if 'title' in child....
[ "def", "process_xml", "(", "self", ",", "xml", ")", ":", "root", "=", "objectify", ".", "fromstring", "(", "xml", ",", "parser", "=", "etree", ".", "XMLParser", "(", ")", ")", "for", "child", "in", "root", ".", "getchildren", "(", ")", ":", "if", "...
Parse tool configuration data out of the Common Cartridge LTI link XML.
[ "Parse", "tool", "configuration", "data", "out", "of", "the", "Common", "Cartridge", "LTI", "link", "XML", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_config.py#L105-L170
train
tophatmonocle/ims_lti_py
ims_lti_py/tool_config.py
ToolConfig.to_xml
def to_xml(self, opts = defaultdict(lambda: None)): ''' Generate XML from the current settings. ''' if not self.launch_url or not self.secure_launch_url: raise InvalidLTIConfigError('Invalid LTI configuration') root = etree.Element('cartridge_basiclti_link', attrib ...
python
def to_xml(self, opts = defaultdict(lambda: None)): ''' Generate XML from the current settings. ''' if not self.launch_url or not self.secure_launch_url: raise InvalidLTIConfigError('Invalid LTI configuration') root = etree.Element('cartridge_basiclti_link', attrib ...
[ "def", "to_xml", "(", "self", ",", "opts", "=", "defaultdict", "(", "lambda", ":", "None", ")", ")", ":", "if", "not", "self", ".", "launch_url", "or", "not", "self", ".", "secure_launch_url", ":", "raise", "InvalidLTIConfigError", "(", "'Invalid LTI configu...
Generate XML from the current settings.
[ "Generate", "XML", "from", "the", "current", "settings", "." ]
979244d83c2e6420d2c1941f58e52f641c56ad12
https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_config.py#L185-L247
train
codelv/enaml-native
src/enamlnative/android/android_fragment.py
AndroidFragment.destroy
def destroy(self): """ Custom destructor that deletes the fragment and removes itself from the adapter it was added to. """ #: Destroy fragment fragment = self.fragment if fragment: #: Stop listening fragment.setFragmentListener(None) ...
python
def destroy(self): """ Custom destructor that deletes the fragment and removes itself from the adapter it was added to. """ #: Destroy fragment fragment = self.fragment if fragment: #: Stop listening fragment.setFragmentListener(None) ...
[ "def", "destroy", "(", "self", ")", ":", "fragment", "=", "self", ".", "fragment", "if", "fragment", ":", "fragment", ".", "setFragmentListener", "(", "None", ")", "if", "self", ".", "adapter", "is", "not", "None", ":", "self", ".", "adapter", ".", "re...
Custom destructor that deletes the fragment and removes itself from the adapter it was added to.
[ "Custom", "destructor", "that", "deletes", "the", "fragment", "and", "removes", "itself", "from", "the", "adapter", "it", "was", "added", "to", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_fragment.py#L96-L112
train
codelv/enaml-native
src/enamlnative/android/android_fragment.py
AndroidFragment.on_create_view
def on_create_view(self): """ Trigger the click """ d = self.declaration changed = not d.condition if changed: d.condition = True view = self.get_view() if changed: self.ready.set_result(True) return view
python
def on_create_view(self): """ Trigger the click """ d = self.declaration changed = not d.condition if changed: d.condition = True view = self.get_view() if changed: self.ready.set_result(True) return view
[ "def", "on_create_view", "(", "self", ")", ":", "d", "=", "self", ".", "declaration", "changed", "=", "not", "d", ".", "condition", "if", "changed", ":", "d", ".", "condition", "=", "True", "view", "=", "self", ".", "get_view", "(", ")", "if", "chang...
Trigger the click
[ "Trigger", "the", "click" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_fragment.py#L117-L131
train
codelv/enaml-native
src/enamlnative/android/android_fragment.py
AndroidFragment.get_view
def get_view(self): """ Get the page to display. If a view has already been created and is cached, use that otherwise initialize the view and proxy. If defer loading is used, wrap the view in a FrameLayout and defer add view until later. """ d = self.declaratio...
python
def get_view(self): """ Get the page to display. If a view has already been created and is cached, use that otherwise initialize the view and proxy. If defer loading is used, wrap the view in a FrameLayout and defer add view until later. """ d = self.declaratio...
[ "def", "get_view", "(", "self", ")", ":", "d", "=", "self", ".", "declaration", "if", "d", ".", "cached", "and", "self", ".", "widget", ":", "return", "self", ".", "widget", "if", "d", ".", "defer_loading", ":", "self", ".", "widget", "=", "FrameLayo...
Get the page to display. If a view has already been created and is cached, use that otherwise initialize the view and proxy. If defer loading is used, wrap the view in a FrameLayout and defer add view until later.
[ "Get", "the", "page", "to", "display", ".", "If", "a", "view", "has", "already", "been", "created", "and", "is", "cached", "use", "that", "otherwise", "initialize", "the", "view", "and", "proxy", ".", "If", "defer", "loading", "is", "used", "wrap", "the"...
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_fragment.py#L150-L167
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
engine
def engine(func): """Callback-oriented decorator for asynchronous generators. This is an older interface; for new code that does not need to be compatible with versions of Tornado older than 3.0 the `coroutine` decorator is recommended instead. This decorator is similar to `coroutine`, except it d...
python
def engine(func): """Callback-oriented decorator for asynchronous generators. This is an older interface; for new code that does not need to be compatible with versions of Tornado older than 3.0 the `coroutine` decorator is recommended instead. This decorator is similar to `coroutine`, except it d...
[ "def", "engine", "(", "func", ")", ":", "func", "=", "_make_coroutine_wrapper", "(", "func", ",", "replace_callback", "=", "False", ")", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":"...
Callback-oriented decorator for asynchronous generators. This is an older interface; for new code that does not need to be compatible with versions of Tornado older than 3.0 the `coroutine` decorator is recommended instead. This decorator is similar to `coroutine`, except it does not return a `.Fu...
[ "Callback", "-", "oriented", "decorator", "for", "asynchronous", "generators", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L174-L206
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
Task
def Task(func, *args, **kwargs): """Adapts a callback-based asynchronous function for use in coroutines. Takes a function (and optional additional arguments) and runs it with those arguments plus a ``callback`` keyword argument. The argument passed to the callback is returned as the result of the yiel...
python
def Task(func, *args, **kwargs): """Adapts a callback-based asynchronous function for use in coroutines. Takes a function (and optional additional arguments) and runs it with those arguments plus a ``callback`` keyword argument. The argument passed to the callback is returned as the result of the yiel...
[ "def", "Task", "(", "func", ",", "*", "args", ",", "**", "kwargs", ")", ":", "future", "=", "Future", "(", ")", "def", "handle_exception", "(", "typ", ",", "value", ",", "tb", ")", ":", "if", "future", ".", "done", "(", ")", ":", "return", "False...
Adapts a callback-based asynchronous function for use in coroutines. Takes a function (and optional additional arguments) and runs it with those arguments plus a ``callback`` keyword argument. The argument passed to the callback is returned as the result of the yield expression. .. versionchanged:: 4...
[ "Adapts", "a", "callback", "-", "based", "asynchronous", "function", "for", "use", "in", "coroutines", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L608-L634
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
_contains_yieldpoint
def _contains_yieldpoint(children): """Returns True if ``children`` contains any YieldPoints. ``children`` may be a dict or a list, as used by `MultiYieldPoint` and `multi_future`. """ if isinstance(children, dict): return any(isinstance(i, YieldPoint) for i in children.values()) if isi...
python
def _contains_yieldpoint(children): """Returns True if ``children`` contains any YieldPoints. ``children`` may be a dict or a list, as used by `MultiYieldPoint` and `multi_future`. """ if isinstance(children, dict): return any(isinstance(i, YieldPoint) for i in children.values()) if isi...
[ "def", "_contains_yieldpoint", "(", "children", ")", ":", "if", "isinstance", "(", "children", ",", "dict", ")", ":", "return", "any", "(", "isinstance", "(", "i", ",", "YieldPoint", ")", "for", "i", "in", "children", ".", "values", "(", ")", ")", "if"...
Returns True if ``children`` contains any YieldPoints. ``children`` may be a dict or a list, as used by `MultiYieldPoint` and `multi_future`.
[ "Returns", "True", "if", "children", "contains", "any", "YieldPoints", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L678-L688
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
_argument_adapter
def _argument_adapter(callback): """Returns a function that when invoked runs ``callback`` with one arg. If the function returned by this function is called with exactly one argument, that argument is passed to ``callback``. Otherwise the args tuple and kwargs dict are wrapped in an `Arguments` object...
python
def _argument_adapter(callback): """Returns a function that when invoked runs ``callback`` with one arg. If the function returned by this function is called with exactly one argument, that argument is passed to ``callback``. Otherwise the args tuple and kwargs dict are wrapped in an `Arguments` object...
[ "def", "_argument_adapter", "(", "callback", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "if", "kwargs", "or", "len", "(", "args", ")", ">", "1", ":", "callback", "(", "Arguments", "(", "args", ",", "kwargs", ")", "...
Returns a function that when invoked runs ``callback`` with one arg. If the function returned by this function is called with exactly one argument, that argument is passed to ``callback``. Otherwise the args tuple and kwargs dict are wrapped in an `Arguments` object.
[ "Returns", "a", "function", "that", "when", "invoked", "runs", "callback", "with", "one", "arg", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L1222-L1236
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
WaitIterator.done
def done(self): """Returns True if this iterator has no more results.""" if self._finished or self._unfinished: return False # Clear the 'current' values when iteration is done. self.current_index = self.current_future = None return True
python
def done(self): """Returns True if this iterator has no more results.""" if self._finished or self._unfinished: return False # Clear the 'current' values when iteration is done. self.current_index = self.current_future = None return True
[ "def", "done", "(", "self", ")", ":", "if", "self", ".", "_finished", "or", "self", ".", "_unfinished", ":", "return", "False", "self", ".", "current_index", "=", "self", ".", "current_future", "=", "None", "return", "True" ]
Returns True if this iterator has no more results.
[ "Returns", "True", "if", "this", "iterator", "has", "no", "more", "results", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L455-L461
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
WaitIterator._return_result
def _return_result(self, done): """Called set the returned future's state that of the future we yielded, and set the current future for the iterator. """ chain_future(done, self._running_future) self.current_future = done self.current_index = self._unfinished.pop(done)
python
def _return_result(self, done): """Called set the returned future's state that of the future we yielded, and set the current future for the iterator. """ chain_future(done, self._running_future) self.current_future = done self.current_index = self._unfinished.pop(done)
[ "def", "_return_result", "(", "self", ",", "done", ")", ":", "chain_future", "(", "done", ",", "self", ".", "_running_future", ")", "self", ".", "current_future", "=", "done", "self", ".", "current_index", "=", "self", ".", "_unfinished", ".", "pop", "(", ...
Called set the returned future's state that of the future we yielded, and set the current future for the iterator.
[ "Called", "set", "the", "returned", "future", "s", "state", "that", "of", "the", "future", "we", "yielded", "and", "set", "the", "current", "future", "for", "the", "iterator", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L482-L489
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
Runner.register_callback
def register_callback(self, key): """Adds ``key`` to the list of callbacks.""" if self.pending_callbacks is None: # Lazily initialize the old-style YieldPoint data structures. self.pending_callbacks = set() self.results = {} if key in self.pending_callbacks: ...
python
def register_callback(self, key): """Adds ``key`` to the list of callbacks.""" if self.pending_callbacks is None: # Lazily initialize the old-style YieldPoint data structures. self.pending_callbacks = set() self.results = {} if key in self.pending_callbacks: ...
[ "def", "register_callback", "(", "self", ",", "key", ")", ":", "if", "self", ".", "pending_callbacks", "is", "None", ":", "self", ".", "pending_callbacks", "=", "set", "(", ")", "self", ".", "results", "=", "{", "}", "if", "key", "in", "self", ".", "...
Adds ``key`` to the list of callbacks.
[ "Adds", "key", "to", "the", "list", "of", "callbacks", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L1047-L1055
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
Runner.is_ready
def is_ready(self, key): """Returns true if a result is available for ``key``.""" if self.pending_callbacks is None or key not in self.pending_callbacks: raise UnknownKeyError("key %r is not pending" % (key,)) return key in self.results
python
def is_ready(self, key): """Returns true if a result is available for ``key``.""" if self.pending_callbacks is None or key not in self.pending_callbacks: raise UnknownKeyError("key %r is not pending" % (key,)) return key in self.results
[ "def", "is_ready", "(", "self", ",", "key", ")", ":", "if", "self", ".", "pending_callbacks", "is", "None", "or", "key", "not", "in", "self", ".", "pending_callbacks", ":", "raise", "UnknownKeyError", "(", "\"key %r is not pending\"", "%", "(", "key", ",", ...
Returns true if a result is available for ``key``.
[ "Returns", "true", "if", "a", "result", "is", "available", "for", "key", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L1057-L1061
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
Runner.set_result
def set_result(self, key, result): """Sets the result for ``key`` and attempts to resume the generator.""" self.results[key] = result if self.yield_point is not None and self.yield_point.is_ready(): try: self.future.set_result(self.yield_point.get_result()) ...
python
def set_result(self, key, result): """Sets the result for ``key`` and attempts to resume the generator.""" self.results[key] = result if self.yield_point is not None and self.yield_point.is_ready(): try: self.future.set_result(self.yield_point.get_result()) ...
[ "def", "set_result", "(", "self", ",", "key", ",", "result", ")", ":", "self", ".", "results", "[", "key", "]", "=", "result", "if", "self", ".", "yield_point", "is", "not", "None", "and", "self", ".", "yield_point", ".", "is_ready", "(", ")", ":", ...
Sets the result for ``key`` and attempts to resume the generator.
[ "Sets", "the", "result", "for", "key", "and", "attempts", "to", "resume", "the", "generator", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L1063-L1072
train
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
Runner.pop_result
def pop_result(self, key): """Returns the result for ``key`` and unregisters it.""" self.pending_callbacks.remove(key) return self.results.pop(key)
python
def pop_result(self, key): """Returns the result for ``key`` and unregisters it.""" self.pending_callbacks.remove(key) return self.results.pop(key)
[ "def", "pop_result", "(", "self", ",", "key", ")", ":", "self", ".", "pending_callbacks", ".", "remove", "(", "key", ")", "return", "self", ".", "results", ".", "pop", "(", "key", ")" ]
Returns the result for ``key`` and unregisters it.
[ "Returns", "the", "result", "for", "key", "and", "unregisters", "it", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L1074-L1077
train
codelv/enaml-native
src/enamlnative/core/dev.py
TornadoDevClient.write_message
def write_message(self, data, binary=False): """ Write a message to the client """ self.connection.write_message(data, binary)
python
def write_message(self, data, binary=False): """ Write a message to the client """ self.connection.write_message(data, binary)
[ "def", "write_message", "(", "self", ",", "data", ",", "binary", "=", "False", ")", ":", "self", ".", "connection", ".", "write_message", "(", "data", ",", "binary", ")" ]
Write a message to the client
[ "Write", "a", "message", "to", "the", "client" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L361-L363
train
codelv/enaml-native
src/enamlnative/core/dev.py
DevServer.render_files
def render_files(self, root=None): """ Render the file path as accordions """ if root is None: tmp = os.environ.get('TMP') root = sys.path[1 if tmp and tmp in sys.path else 0] items = [] for filename in os.listdir(root): # for subdirname in di...
python
def render_files(self, root=None): """ Render the file path as accordions """ if root is None: tmp = os.environ.get('TMP') root = sys.path[1 if tmp and tmp in sys.path else 0] items = [] for filename in os.listdir(root): # for subdirname in di...
[ "def", "render_files", "(", "self", ",", "root", "=", "None", ")", ":", "if", "root", "is", "None", ":", "tmp", "=", "os", ".", "environ", ".", "get", "(", "'TMP'", ")", "root", "=", "sys", ".", "path", "[", "1", "if", "tmp", "and", "tmp", "in"...
Render the file path as accordions
[ "Render", "the", "file", "path", "as", "accordions" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L491-L514
train
codelv/enaml-native
src/enamlnative/core/dev.py
DevServerSession.start
def start(self): """ Start the dev session. Attempt to use tornado first, then try twisted """ print("Starting debug client cwd: {}".format(os.getcwd())) print("Sys path: {}".format(sys.path)) #: Initialize the hotswapper self.hotswap = Hotswapper(debug...
python
def start(self): """ Start the dev session. Attempt to use tornado first, then try twisted """ print("Starting debug client cwd: {}".format(os.getcwd())) print("Sys path: {}".format(sys.path)) #: Initialize the hotswapper self.hotswap = Hotswapper(debug...
[ "def", "start", "(", "self", ")", ":", "print", "(", "\"Starting debug client cwd: {}\"", ".", "format", "(", "os", ".", "getcwd", "(", ")", ")", ")", "print", "(", "\"Sys path: {}\"", ".", "format", "(", "sys", ".", "path", ")", ")", "self", ".", "hot...
Start the dev session. Attempt to use tornado first, then try twisted
[ "Start", "the", "dev", "session", ".", "Attempt", "to", "use", "tornado", "first", "then", "try", "twisted" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L782-L796
train
codelv/enaml-native
src/enamlnative/core/dev.py
DevServerSession._default_url
def _default_url(self): """ Websocket URL to connect to and listen for reload requests """ host = 'localhost' if self.mode == 'remote' else self.host return 'ws://{}:{}/dev'.format(host, self.port)
python
def _default_url(self): """ Websocket URL to connect to and listen for reload requests """ host = 'localhost' if self.mode == 'remote' else self.host return 'ws://{}:{}/dev'.format(host, self.port)
[ "def", "_default_url", "(", "self", ")", ":", "host", "=", "'localhost'", "if", "self", ".", "mode", "==", "'remote'", "else", "self", ".", "host", "return", "'ws://{}:{}/dev'", ".", "format", "(", "host", ",", "self", ".", "port", ")" ]
Websocket URL to connect to and listen for reload requests
[ "Websocket", "URL", "to", "connect", "to", "and", "listen", "for", "reload", "requests" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L810-L813
train
codelv/enaml-native
src/enamlnative/core/dev.py
DevServerSession.write_message
def write_message(self, data, binary=False): """ Write a message to the active client """ self.client.write_message(data, binary=binary)
python
def write_message(self, data, binary=False): """ Write a message to the active client """ self.client.write_message(data, binary=binary)
[ "def", "write_message", "(", "self", ",", "data", ",", "binary", "=", "False", ")", ":", "self", ".", "client", ".", "write_message", "(", "data", ",", "binary", "=", "binary", ")" ]
Write a message to the active client
[ "Write", "a", "message", "to", "the", "active", "client" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L843-L847
train
codelv/enaml-native
src/enamlnative/core/dev.py
DevServerSession.handle_message
def handle_message(self, data): """ When we get a message """ msg = json.loads(data) print("Dev server message: {}".format(msg)) handler_name = 'do_{}'.format(msg['type']) if hasattr(self, handler_name): handler = getattr(self, handler_name) result = handl...
python
def handle_message(self, data): """ When we get a message """ msg = json.loads(data) print("Dev server message: {}".format(msg)) handler_name = 'do_{}'.format(msg['type']) if hasattr(self, handler_name): handler = getattr(self, handler_name) result = handl...
[ "def", "handle_message", "(", "self", ",", "data", ")", ":", "msg", "=", "json", ".", "loads", "(", "data", ")", "print", "(", "\"Dev server message: {}\"", ".", "format", "(", "msg", ")", ")", "handler_name", "=", "'do_{}'", ".", "format", "(", "msg", ...
When we get a message
[ "When", "we", "get", "a", "message" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L849-L861
train
codelv/enaml-native
src/enamlnative/core/dev.py
DevServerSession.do_reload
def do_reload(self, msg): """ Called when the dev server wants to reload the view. """ #: TODO: This should use the autorelaoder app = self.app #: Show loading screen try: self.app.widget.showLoading("Reloading... Please wait.", now=True) #self.app.widget...
python
def do_reload(self, msg): """ Called when the dev server wants to reload the view. """ #: TODO: This should use the autorelaoder app = self.app #: Show loading screen try: self.app.widget.showLoading("Reloading... Please wait.", now=True) #self.app.widget...
[ "def", "do_reload", "(", "self", ",", "msg", ")", ":", "app", "=", "self", ".", "app", "try", ":", "self", ".", "app", ".", "widget", ".", "showLoading", "(", "\"Reloading... Please wait.\"", ",", "now", "=", "True", ")", "except", ":", "pass", "self",...
Called when the dev server wants to reload the view.
[ "Called", "when", "the", "dev", "server", "wants", "to", "reload", "the", "view", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L866-L900
train
codelv/enaml-native
src/enamlnative/core/dev.py
DevServerSession.do_hotswap
def do_hotswap(self, msg): """ Attempt to hotswap the code """ #: Show hotswap tooltip try: self.app.widget.showTooltip("Hot swapping...", now=True) except: pass self.save_changed_files(msg) hotswap = self.hotswap app = self.app tr...
python
def do_hotswap(self, msg): """ Attempt to hotswap the code """ #: Show hotswap tooltip try: self.app.widget.showTooltip("Hot swapping...", now=True) except: pass self.save_changed_files(msg) hotswap = self.hotswap app = self.app tr...
[ "def", "do_hotswap", "(", "self", ",", "msg", ")", ":", "try", ":", "self", ".", "app", ".", "widget", ".", "showTooltip", "(", "\"Hot swapping...\"", ",", "now", "=", "True", ")", "except", ":", "pass", "self", ".", "save_changed_files", "(", "msg", "...
Attempt to hotswap the code
[ "Attempt", "to", "hotswap", "the", "code" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L902-L919
train
codelv/enaml-native
src/enamlnative/android/android_popup_window.py
AndroidPopupWindow.update
def update(self): """ Update the PopupWindow if it is currently showing. This avoids calling update during initialization. """ if not self.showing: return d = self.declaration self.set_show(d.show)
python
def update(self): """ Update the PopupWindow if it is currently showing. This avoids calling update during initialization. """ if not self.showing: return d = self.declaration self.set_show(d.show)
[ "def", "update", "(", "self", ")", ":", "if", "not", "self", ".", "showing", ":", "return", "d", "=", "self", ".", "declaration", "self", ".", "set_show", "(", "d", ".", "show", ")" ]
Update the PopupWindow if it is currently showing. This avoids calling update during initialization.
[ "Update", "the", "PopupWindow", "if", "it", "is", "currently", "showing", ".", "This", "avoids", "calling", "update", "during", "initialization", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_popup_window.py#L144-L151
train
codelv/enaml-native
src/enamlnative/widgets/fragment.py
Fragment.refresh_items
def refresh_items(self): """ Refresh the items of the pattern. This method destroys the old items and creates and initializes the new items. It is overridden to NOT insert the children to the parent. The Fragment adapter handles this. """ items = [] if s...
python
def refresh_items(self): """ Refresh the items of the pattern. This method destroys the old items and creates and initializes the new items. It is overridden to NOT insert the children to the parent. The Fragment adapter handles this. """ items = [] if s...
[ "def", "refresh_items", "(", "self", ")", ":", "items", "=", "[", "]", "if", "self", ".", "condition", ":", "for", "nodes", ",", "key", ",", "f_locals", "in", "self", ".", "pattern_nodes", ":", "with", "new_scope", "(", "key", ",", "f_locals", ")", "...
Refresh the items of the pattern. This method destroys the old items and creates and initializes the new items. It is overridden to NOT insert the children to the parent. The Fragment adapter handles this.
[ "Refresh", "the", "items", "of", "the", "pattern", ".", "This", "method", "destroys", "the", "old", "items", "and", "creates", "and", "initializes", "the", "new", "items", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/widgets/fragment.py#L49-L76
train
codelv/enaml-native
src/enamlnative/core/import_hooks.py
ExtensionImporter.load_module
def load_module(self, mod): """ Load the extension using the load_dynamic method. """ try: return sys.modules[mod] except KeyError: pass lib = ExtensionImporter.extension_modules[mod] m = imp.load_dynamic(mod, lib) sys.modules[mod] = m ret...
python
def load_module(self, mod): """ Load the extension using the load_dynamic method. """ try: return sys.modules[mod] except KeyError: pass lib = ExtensionImporter.extension_modules[mod] m = imp.load_dynamic(mod, lib) sys.modules[mod] = m ret...
[ "def", "load_module", "(", "self", ",", "mod", ")", ":", "try", ":", "return", "sys", ".", "modules", "[", "mod", "]", "except", "KeyError", ":", "pass", "lib", "=", "ExtensionImporter", ".", "extension_modules", "[", "mod", "]", "m", "=", "imp", ".", ...
Load the extension using the load_dynamic method.
[ "Load", "the", "extension", "using", "the", "load_dynamic", "method", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/import_hooks.py#L41-L51
train
codelv/enaml-native
src/enamlnative/android/android_tab_layout.py
AndroidTabLayout.destroy
def destroy(self): """ Destroy all tabs when destroyed """ super(AndroidTabLayout, self).destroy() if self.tabs: del self.tabs
python
def destroy(self): """ Destroy all tabs when destroyed """ super(AndroidTabLayout, self).destroy() if self.tabs: del self.tabs
[ "def", "destroy", "(", "self", ")", ":", "super", "(", "AndroidTabLayout", ",", "self", ")", ".", "destroy", "(", ")", "if", "self", ".", "tabs", ":", "del", "self", ".", "tabs" ]
Destroy all tabs when destroyed
[ "Destroy", "all", "tabs", "when", "destroyed" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_tab_layout.py#L123-L129
train
codelv/enaml-native
src/enamlnative/core/hotswap/core.py
update_atom_members
def update_atom_members(old, new): """ Update an atom member """ old_keys = old.members().keys() new_keys = new.members().keys() for key in old_keys: old_obj = getattr(old, key) try: new_obj = getattr(new, key) if old_obj == new_obj: continue ...
python
def update_atom_members(old, new): """ Update an atom member """ old_keys = old.members().keys() new_keys = new.members().keys() for key in old_keys: old_obj = getattr(old, key) try: new_obj = getattr(new, key) if old_obj == new_obj: continue ...
[ "def", "update_atom_members", "(", "old", ",", "new", ")", ":", "old_keys", "=", "old", ".", "members", "(", ")", ".", "keys", "(", ")", "new_keys", "=", "new", ".", "members", "(", ")", ".", "keys", "(", ")", "for", "key", "in", "old_keys", ":", ...
Update an atom member
[ "Update", "an", "atom", "member" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/core.py#L44-L76
train
codelv/enaml-native
src/enamlnative/core/hotswap/core.py
update_class_by_type
def update_class_by_type(old, new): """ Update declarative classes or fallback on default """ autoreload.update_class(old, new) if isinstance2(old, new, AtomMeta): update_atom_members(old, new)
python
def update_class_by_type(old, new): """ Update declarative classes or fallback on default """ autoreload.update_class(old, new) if isinstance2(old, new, AtomMeta): update_atom_members(old, new)
[ "def", "update_class_by_type", "(", "old", ",", "new", ")", ":", "autoreload", ".", "update_class", "(", "old", ",", "new", ")", "if", "isinstance2", "(", "old", ",", "new", ",", "AtomMeta", ")", ":", "update_atom_members", "(", "old", ",", "new", ")" ]
Update declarative classes or fallback on default
[ "Update", "declarative", "classes", "or", "fallback", "on", "default" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/core.py#L79-L83
train
codelv/enaml-native
src/enamlnative/core/hotswap/core.py
Hotswapper.update
def update(self, old, new=None): """ Update given view declaration with new declaration Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative or None The new or reloaded view instance to that will be ...
python
def update(self, old, new=None): """ Update given view declaration with new declaration Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative or None The new or reloaded view instance to that will be ...
[ "def", "update", "(", "self", ",", "old", ",", "new", "=", "None", ")", ":", "if", "not", "new", ":", "new", "=", "type", "(", "old", ")", "(", ")", "if", "not", "new", ".", "is_initialized", ":", "new", ".", "initialize", "(", ")", "if", "self...
Update given view declaration with new declaration Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative or None The new or reloaded view instance to that will be used to update the existing view....
[ "Update", "given", "view", "declaration", "with", "new", "declaration" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/core.py#L129-L159
train
codelv/enaml-native
src/enamlnative/core/hotswap/core.py
Hotswapper.find_best_matching_node
def find_best_matching_node(self, new, old_nodes): """ Find the node that best matches the new node given the old nodes. If no good match exists return `None`. """ name = new.__class__.__name__ #: TODO: We should pick the BEST one from this list #: based on some "mat...
python
def find_best_matching_node(self, new, old_nodes): """ Find the node that best matches the new node given the old nodes. If no good match exists return `None`. """ name = new.__class__.__name__ #: TODO: We should pick the BEST one from this list #: based on some "mat...
[ "def", "find_best_matching_node", "(", "self", ",", "new", ",", "old_nodes", ")", ":", "name", "=", "new", ".", "__class__", ".", "__name__", "matches", "=", "[", "c", "for", "c", "in", "old_nodes", "if", "name", "==", "c", ".", "__class__", ".", "__na...
Find the node that best matches the new node given the old nodes. If no good match exists return `None`.
[ "Find", "the", "node", "that", "best", "matches", "the", "new", "node", "given", "the", "old", "nodes", ".", "If", "no", "good", "match", "exists", "return", "None", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/core.py#L161-L172
train
codelv/enaml-native
src/enamlnative/core/hotswap/core.py
Hotswapper.update_attrs
def update_attrs(self, old, new): """ Update any `attr` members. Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative The new view instance that should be used for updating ...
python
def update_attrs(self, old, new): """ Update any `attr` members. Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative The new view instance that should be used for updating ...
[ "def", "update_attrs", "(", "self", ",", "old", ",", "new", ")", ":", "if", "new", ".", "_d_storage", ":", "old", ".", "_d_storage", "=", "new", ".", "_d_storage" ]
Update any `attr` members. Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative The new view instance that should be used for updating
[ "Update", "any", "attr", "members", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/core.py#L248-L261
train
codelv/enaml-native
src/enamlnative/core/hotswap/core.py
Hotswapper.update_bindings
def update_bindings(self, old, new): """ Update any enaml operator bindings. Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative The new view instance that should be used for...
python
def update_bindings(self, old, new): """ Update any enaml operator bindings. Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative The new view instance that should be used for...
[ "def", "update_bindings", "(", "self", ",", "old", ",", "new", ")", ":", "if", "new", ".", "_d_engine", ":", "old", ".", "_d_engine", "=", "new", ".", "_d_engine", "engine", "=", "old", ".", "_d_engine", "for", "k", "in", "engine", ".", "_handlers", ...
Update any enaml operator bindings. Parameters ----------- old: Declarative The existing view instance that needs to be updated new: Declarative The new view instance that should be used for updating
[ "Update", "any", "enaml", "operator", "bindings", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/hotswap/core.py#L280-L304
train
codelv/enaml-native
src/enamlnative/android/android_view.py
AndroidView.init_widget
def init_widget(self): """ Initialize the underlying widget. This reads all items declared in the enamldef block for this node and sets only the values that have been specified. All other values will be left as default. Doing it this way makes atom to only create the ...
python
def init_widget(self): """ Initialize the underlying widget. This reads all items declared in the enamldef block for this node and sets only the values that have been specified. All other values will be left as default. Doing it this way makes atom to only create the ...
[ "def", "init_widget", "(", "self", ")", ":", "super", "(", "AndroidView", ",", "self", ")", ".", "init_widget", "(", ")", "for", "k", ",", "v", "in", "self", ".", "get_declared_items", "(", ")", ":", "handler", "=", "getattr", "(", "self", ",", "'set...
Initialize the underlying widget. This reads all items declared in the enamldef block for this node and sets only the values that have been specified. All other values will be left as default. Doing it this way makes atom to only create the properties that need to be overridd...
[ "Initialize", "the", "underlying", "widget", ".", "This", "reads", "all", "items", "declared", "in", "the", "enamldef", "block", "for", "this", "node", "and", "sets", "only", "the", "values", "that", "have", "been", "specified", ".", "All", "other", "values"...
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view.py#L147-L168
train
codelv/enaml-native
src/enamlnative/android/android_view.py
AndroidView.on_key
def on_key(self, view, key, event): """ Trigger the key event Parameters ---------- view: int The ID of the view that sent this event key: int The code of the key that was pressed data: bytes The msgpack encoded key event """ ...
python
def on_key(self, view, key, event): """ Trigger the key event Parameters ---------- view: int The ID of the view that sent this event key: int The code of the key that was pressed data: bytes The msgpack encoded key event """ ...
[ "def", "on_key", "(", "self", ",", "view", ",", "key", ",", "event", ")", ":", "d", "=", "self", ".", "declaration", "r", "=", "{", "'key'", ":", "key", ",", "'result'", ":", "False", "}", "d", ".", "key_event", "(", "r", ")", "return", "r", "[...
Trigger the key event Parameters ---------- view: int The ID of the view that sent this event key: int The code of the key that was pressed data: bytes The msgpack encoded key event
[ "Trigger", "the", "key", "event" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view.py#L221-L237
train
codelv/enaml-native
src/enamlnative/android/android_view.py
AndroidView.on_touch
def on_touch(self, view, event): """ Trigger the touch event Parameters ---------- view: int The ID of the view that sent this event data: bytes The msgpack encoded key event """ d = self.declaration r = {'event': event, 'result':...
python
def on_touch(self, view, event): """ Trigger the touch event Parameters ---------- view: int The ID of the view that sent this event data: bytes The msgpack encoded key event """ d = self.declaration r = {'event': event, 'result':...
[ "def", "on_touch", "(", "self", ",", "view", ",", "event", ")", ":", "d", "=", "self", ".", "declaration", "r", "=", "{", "'event'", ":", "event", ",", "'result'", ":", "False", "}", "d", ".", "touch_event", "(", "r", ")", "return", "r", "[", "'r...
Trigger the touch event Parameters ---------- view: int The ID of the view that sent this event data: bytes The msgpack encoded key event
[ "Trigger", "the", "touch", "event" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view.py#L242-L256
train
codelv/enaml-native
src/enamlnative/android/android_view.py
AndroidView.set_visible
def set_visible(self, visible): """ Set the visibility of the widget. """ v = View.VISIBILITY_VISIBLE if visible else View.VISIBILITY_GONE self.widget.setVisibility(v)
python
def set_visible(self, visible): """ Set the visibility of the widget. """ v = View.VISIBILITY_VISIBLE if visible else View.VISIBILITY_GONE self.widget.setVisibility(v)
[ "def", "set_visible", "(", "self", ",", "visible", ")", ":", "v", "=", "View", ".", "VISIBILITY_VISIBLE", "if", "visible", "else", "View", ".", "VISIBILITY_GONE", "self", ".", "widget", ".", "setVisibility", "(", "v", ")" ]
Set the visibility of the widget.
[ "Set", "the", "visibility", "of", "the", "widget", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view.py#L301-L306
train
codelv/enaml-native
src/enamlnative/core/loop.py
EventLoop.default
def default(cls): """ Get the first available event loop implementation based on which packages are installed. """ with enamlnative.imports(): for impl in [ TornadoEventLoop, TwistedEventLoop, BuiltinEventLoop, ...
python
def default(cls): """ Get the first available event loop implementation based on which packages are installed. """ with enamlnative.imports(): for impl in [ TornadoEventLoop, TwistedEventLoop, BuiltinEventLoop, ...
[ "def", "default", "(", "cls", ")", ":", "with", "enamlnative", ".", "imports", "(", ")", ":", "for", "impl", "in", "[", "TornadoEventLoop", ",", "TwistedEventLoop", ",", "BuiltinEventLoop", ",", "]", ":", "if", "impl", ".", "available", "(", ")", ":", ...
Get the first available event loop implementation based on which packages are installed.
[ "Get", "the", "first", "available", "event", "loop", "implementation", "based", "on", "which", "packages", "are", "installed", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/loop.py#L34-L49
train
codelv/enaml-native
src/enamlnative/core/loop.py
EventLoop.log_error
def log_error(self, callback, error=None): """ Log the error that occurred when running the given callback. """ print("Uncaught error during callback: {}".format(callback)) print("Error: {}".format(error))
python
def log_error(self, callback, error=None): """ Log the error that occurred when running the given callback. """ print("Uncaught error during callback: {}".format(callback)) print("Error: {}".format(error))
[ "def", "log_error", "(", "self", ",", "callback", ",", "error", "=", "None", ")", ":", "print", "(", "\"Uncaught error during callback: {}\"", ".", "format", "(", "callback", ")", ")", "print", "(", "\"Error: {}\"", ".", "format", "(", "error", ")", ")" ]
Log the error that occurred when running the given callback.
[ "Log", "the", "error", "that", "occurred", "when", "running", "the", "given", "callback", "." ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/loop.py#L117-L120
train
codelv/enaml-native
src/enamlnative/ios/uikit_view.py
UiKitView.update_frame
def update_frame(self): """ Define the view frame for this widgets""" d = self.declaration if d.x or d.y or d.width or d.height: self.frame = (d.x, d.y, d.width, d.height)
python
def update_frame(self): """ Define the view frame for this widgets""" d = self.declaration if d.x or d.y or d.width or d.height: self.frame = (d.x, d.y, d.width, d.height)
[ "def", "update_frame", "(", "self", ")", ":", "d", "=", "self", ".", "declaration", "if", "d", ".", "x", "or", "d", ".", "y", "or", "d", ".", "width", "or", "d", ".", "height", ":", "self", ".", "frame", "=", "(", "d", ".", "x", ",", "d", "...
Define the view frame for this widgets
[ "Define", "the", "view", "frame", "for", "this", "widgets" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/ios/uikit_view.py#L171-L175
train
codelv/enaml-native
src/enamlnative/android/android_view_pager.py
AndroidViewPager.child_added
def child_added(self, child): """ When a child is added, schedule a data changed notification """ super(AndroidViewPager, self).child_added(child) self._notify_count += 1 self.get_context().timed_call( self._notify_delay, self._notify_change)
python
def child_added(self, child): """ When a child is added, schedule a data changed notification """ super(AndroidViewPager, self).child_added(child) self._notify_count += 1 self.get_context().timed_call( self._notify_delay, self._notify_change)
[ "def", "child_added", "(", "self", ",", "child", ")", ":", "super", "(", "AndroidViewPager", ",", "self", ")", ".", "child_added", "(", "child", ")", "self", ".", "_notify_count", "+=", "1", "self", ".", "get_context", "(", ")", ".", "timed_call", "(", ...
When a child is added, schedule a data changed notification
[ "When", "a", "child", "is", "added", "schedule", "a", "data", "changed", "notification" ]
c33986e9eda468c508806e0a3e73c771401e5718
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_view_pager.py#L163-L168
train