id
int32
0
252k
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
249,300
dossier/dossier.fc
python/dossier/fc/feature_collection.py
FeatureCollection.to_dict
def to_dict(self): '''Dump a feature collection's features to a dictionary. This does not include additional data, such as whether or not the collection is read-only. The returned dictionary is suitable for serialization into JSON, CBOR, or similar data formats. ''' ...
python
def to_dict(self): '''Dump a feature collection's features to a dictionary. This does not include additional data, such as whether or not the collection is read-only. The returned dictionary is suitable for serialization into JSON, CBOR, or similar data formats. ''' ...
[ "def", "to_dict", "(", "self", ")", ":", "def", "is_non_native_sc", "(", "ty", ",", "encoded", ")", ":", "return", "(", "ty", "==", "'StringCounter'", "and", "not", "is_native_string_counter", "(", "encoded", ")", ")", "fc", "=", "{", "}", "native", "=",...
Dump a feature collection's features to a dictionary. This does not include additional data, such as whether or not the collection is read-only. The returned dictionary is suitable for serialization into JSON, CBOR, or similar data formats.
[ "Dump", "a", "feature", "collection", "s", "features", "to", "a", "dictionary", "." ]
3e969d0cb2592fc06afc1c849d2b22283450b5e2
https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_collection.py#L256-L283
249,301
dossier/dossier.fc
python/dossier/fc/feature_collection.py
FeatureCollection.merge_with
def merge_with(self, other, multiset_op, other_op=None): '''Merge this feature collection with another. Merges two feature collections using the given ``multiset_op`` on each corresponding multiset and returns a new :class:`FeatureCollection`. The contents of the two original fe...
python
def merge_with(self, other, multiset_op, other_op=None): '''Merge this feature collection with another. Merges two feature collections using the given ``multiset_op`` on each corresponding multiset and returns a new :class:`FeatureCollection`. The contents of the two original fe...
[ "def", "merge_with", "(", "self", ",", "other", ",", "multiset_op", ",", "other_op", "=", "None", ")", ":", "result", "=", "FeatureCollection", "(", ")", "for", "ms_name", "in", "set", "(", "self", ".", "_counters", "(", ")", ")", "|", "set", "(", "o...
Merge this feature collection with another. Merges two feature collections using the given ``multiset_op`` on each corresponding multiset and returns a new :class:`FeatureCollection`. The contents of the two original feature collections are not modified. For each feature name i...
[ "Merge", "this", "feature", "collection", "with", "another", "." ]
3e969d0cb2592fc06afc1c849d2b22283450b5e2
https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_collection.py#L327-L370
249,302
dossier/dossier.fc
python/dossier/fc/feature_collection.py
FeatureCollection.total
def total(self): ''' Returns sum of all counts in all features that are multisets. ''' feats = imap(lambda name: self[name], self._counters()) return sum(chain(*map(lambda mset: map(abs, mset.values()), feats)))
python
def total(self): ''' Returns sum of all counts in all features that are multisets. ''' feats = imap(lambda name: self[name], self._counters()) return sum(chain(*map(lambda mset: map(abs, mset.values()), feats)))
[ "def", "total", "(", "self", ")", ":", "feats", "=", "imap", "(", "lambda", "name", ":", "self", "[", "name", "]", ",", "self", ".", "_counters", "(", ")", ")", "return", "sum", "(", "chain", "(", "*", "map", "(", "lambda", "mset", ":", "map", ...
Returns sum of all counts in all features that are multisets.
[ "Returns", "sum", "of", "all", "counts", "in", "all", "features", "that", "are", "multisets", "." ]
3e969d0cb2592fc06afc1c849d2b22283450b5e2
https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_collection.py#L451-L456
249,303
dossier/dossier.fc
python/dossier/fc/feature_collection.py
FeatureTypeRegistry.add
def add(self, name, obj): '''Register a new feature serializer. The feature type should be one of the fixed set of feature representations, and `name` should be one of ``StringCounter``, ``SparseVector``, or ``DenseVector``. `obj` is a describing object with three fields: `cons...
python
def add(self, name, obj): '''Register a new feature serializer. The feature type should be one of the fixed set of feature representations, and `name` should be one of ``StringCounter``, ``SparseVector``, or ``DenseVector``. `obj` is a describing object with three fields: `cons...
[ "def", "add", "(", "self", ",", "name", ",", "obj", ")", ":", "ro", "=", "obj", ".", "constructor", "(", ")", "if", "name", "not", "in", "cbor_names_to_tags", ":", "print", "(", "name", ")", "raise", "ValueError", "(", "'Unsupported feature type name: \"%s...
Register a new feature serializer. The feature type should be one of the fixed set of feature representations, and `name` should be one of ``StringCounter``, ``SparseVector``, or ``DenseVector``. `obj` is a describing object with three fields: `constructor` is a callable that c...
[ "Register", "a", "new", "feature", "serializer", "." ]
3e969d0cb2592fc06afc1c849d2b22283450b5e2
https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_collection.py#L585-L620
249,304
nodev-io/nodev.specs
nodev/specs/generic.py
instance_contains
def instance_contains(container, item): """Search into instance attributes, properties and return values of no-args methods.""" return item in (member for _, member in inspect.getmembers(container))
python
def instance_contains(container, item): """Search into instance attributes, properties and return values of no-args methods.""" return item in (member for _, member in inspect.getmembers(container))
[ "def", "instance_contains", "(", "container", ",", "item", ")", ":", "return", "item", "in", "(", "member", "for", "_", ",", "member", "in", "inspect", ".", "getmembers", "(", "container", ")", ")" ]
Search into instance attributes, properties and return values of no-args methods.
[ "Search", "into", "instance", "attributes", "properties", "and", "return", "values", "of", "no", "-", "args", "methods", "." ]
c4740b13f928d2ad39196a4366c98b5f7716ac35
https://github.com/nodev-io/nodev.specs/blob/c4740b13f928d2ad39196a4366c98b5f7716ac35/nodev/specs/generic.py#L45-L47
249,305
nodev-io/nodev.specs
nodev/specs/generic.py
contains
def contains(container, item): """Extends ``operator.contains`` by trying very hard to find ``item`` inside container.""" # equality counts as containment and is usually non destructive if container == item: return True # testing mapping containment is usually non destructive if isinstance...
python
def contains(container, item): """Extends ``operator.contains`` by trying very hard to find ``item`` inside container.""" # equality counts as containment and is usually non destructive if container == item: return True # testing mapping containment is usually non destructive if isinstance...
[ "def", "contains", "(", "container", ",", "item", ")", ":", "# equality counts as containment and is usually non destructive", "if", "container", "==", "item", ":", "return", "True", "# testing mapping containment is usually non destructive", "if", "isinstance", "(", "contain...
Extends ``operator.contains`` by trying very hard to find ``item`` inside container.
[ "Extends", "operator", ".", "contains", "by", "trying", "very", "hard", "to", "find", "item", "inside", "container", "." ]
c4740b13f928d2ad39196a4366c98b5f7716ac35
https://github.com/nodev-io/nodev.specs/blob/c4740b13f928d2ad39196a4366c98b5f7716ac35/nodev/specs/generic.py#L50-L74
249,306
zaturox/glin
glin/app.py
GlinApp.set_brightness
def set_brightness(self, brightness): """set general brightness in range 0...1""" brightness = min([1.0, max([brightness, 0.0])]) # enforces range 0 ... 1 self.state.brightness = brightness self._repeat_last_frame() sequence_number = self.zmq_publisher.publish_brightness(brightne...
python
def set_brightness(self, brightness): """set general brightness in range 0...1""" brightness = min([1.0, max([brightness, 0.0])]) # enforces range 0 ... 1 self.state.brightness = brightness self._repeat_last_frame() sequence_number = self.zmq_publisher.publish_brightness(brightne...
[ "def", "set_brightness", "(", "self", ",", "brightness", ")", ":", "brightness", "=", "min", "(", "[", "1.0", ",", "max", "(", "[", "brightness", ",", "0.0", "]", ")", "]", ")", "# enforces range 0 ... 1", "self", ".", "state", ".", "brightness", "=", ...
set general brightness in range 0...1
[ "set", "general", "brightness", "in", "range", "0", "...", "1" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L47-L54
249,307
zaturox/glin
glin/app.py
GlinApp.register_animation
def register_animation(self, animation_class): """Add a new animation""" self.state.animationClasses.append(animation_class) return len(self.state.animationClasses) - 1
python
def register_animation(self, animation_class): """Add a new animation""" self.state.animationClasses.append(animation_class) return len(self.state.animationClasses) - 1
[ "def", "register_animation", "(", "self", ",", "animation_class", ")", ":", "self", ".", "state", ".", "animationClasses", ".", "append", "(", "animation_class", ")", "return", "len", "(", "self", ".", "state", ".", "animationClasses", ")", "-", "1" ]
Add a new animation
[ "Add", "a", "new", "animation" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L56-L59
249,308
zaturox/glin
glin/app.py
GlinApp.add_scene
def add_scene(self, animation_id, name, color, velocity, config): """Add a new scene, returns Scene ID""" # check arguments if animation_id < 0 or animation_id >= len(self.state.animationClasses): err_msg = "Requested to register scene with invalid Animation ID. Out of range." ...
python
def add_scene(self, animation_id, name, color, velocity, config): """Add a new scene, returns Scene ID""" # check arguments if animation_id < 0 or animation_id >= len(self.state.animationClasses): err_msg = "Requested to register scene with invalid Animation ID. Out of range." ...
[ "def", "add_scene", "(", "self", ",", "animation_id", ",", "name", ",", "color", ",", "velocity", ",", "config", ")", ":", "# check arguments", "if", "animation_id", "<", "0", "or", "animation_id", ">=", "len", "(", "self", ".", "state", ".", "animationCla...
Add a new scene, returns Scene ID
[ "Add", "a", "new", "scene", "returns", "Scene", "ID" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L61-L80
249,309
zaturox/glin
glin/app.py
GlinApp.remove_scene
def remove_scene(self, scene_id): """remove a scene by Scene ID""" if self.state.activeSceneId == scene_id: err_msg = "Requested to delete scene {sceneNum}, which is currently active. Cannot delete active scene.".format(sceneNum=scene_id) logging.info(err_msg) return(...
python
def remove_scene(self, scene_id): """remove a scene by Scene ID""" if self.state.activeSceneId == scene_id: err_msg = "Requested to delete scene {sceneNum}, which is currently active. Cannot delete active scene.".format(sceneNum=scene_id) logging.info(err_msg) return(...
[ "def", "remove_scene", "(", "self", ",", "scene_id", ")", ":", "if", "self", ".", "state", ".", "activeSceneId", "==", "scene_id", ":", "err_msg", "=", "\"Requested to delete scene {sceneNum}, which is currently active. Cannot delete active scene.\"", ".", "format", "(", ...
remove a scene by Scene ID
[ "remove", "a", "scene", "by", "Scene", "ID" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L82-L98
249,310
zaturox/glin
glin/app.py
GlinApp.set_scene_name
def set_scene_name(self, scene_id, name): """rename a scene by scene ID""" if not scene_id in self.state.scenes: # does that scene_id exist? err_msg = "Requested to rename scene {sceneNum}, which does not exist".format(sceneNum=scene_id) logging.info(err_msg) return(F...
python
def set_scene_name(self, scene_id, name): """rename a scene by scene ID""" if not scene_id in self.state.scenes: # does that scene_id exist? err_msg = "Requested to rename scene {sceneNum}, which does not exist".format(sceneNum=scene_id) logging.info(err_msg) return(F...
[ "def", "set_scene_name", "(", "self", ",", "scene_id", ",", "name", ")", ":", "if", "not", "scene_id", "in", "self", ".", "state", ".", "scenes", ":", "# does that scene_id exist?", "err_msg", "=", "\"Requested to rename scene {sceneNum}, which does not exist\"", ".",...
rename a scene by scene ID
[ "rename", "a", "scene", "by", "scene", "ID" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L100-L109
249,311
zaturox/glin
glin/app.py
GlinApp.set_scene_active
def set_scene_active(self, scene_id): """sets the active scene by scene ID""" if self.state.activeSceneId != scene_id: # do nothing if scene has not changed self._deactivate_scene() sequence_number = self.zmq_publisher.publish_active_scene(scene_id) self.state.activeS...
python
def set_scene_active(self, scene_id): """sets the active scene by scene ID""" if self.state.activeSceneId != scene_id: # do nothing if scene has not changed self._deactivate_scene() sequence_number = self.zmq_publisher.publish_active_scene(scene_id) self.state.activeS...
[ "def", "set_scene_active", "(", "self", ",", "scene_id", ")", ":", "if", "self", ".", "state", ".", "activeSceneId", "!=", "scene_id", ":", "# do nothing if scene has not changed", "self", ".", "_deactivate_scene", "(", ")", "sequence_number", "=", "self", ".", ...
sets the active scene by scene ID
[ "sets", "the", "active", "scene", "by", "scene", "ID" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L152-L164
249,312
zaturox/glin
glin/app.py
GlinApp.set_mainswitch_state
def set_mainswitch_state(self, state): """Turns output on or off. Also turns hardware on ir off""" if self.state.mainswitch == state: err_msg = "MainSwitch unchanged, already is {sState}".format(sState="On" if state else "Off") # fo obar lorem ipsum logging.debug(err_msg) # fo ob...
python
def set_mainswitch_state(self, state): """Turns output on or off. Also turns hardware on ir off""" if self.state.mainswitch == state: err_msg = "MainSwitch unchanged, already is {sState}".format(sState="On" if state else "Off") # fo obar lorem ipsum logging.debug(err_msg) # fo ob...
[ "def", "set_mainswitch_state", "(", "self", ",", "state", ")", ":", "if", "self", ".", "state", ".", "mainswitch", "==", "state", ":", "err_msg", "=", "\"MainSwitch unchanged, already is {sState}\"", ".", "format", "(", "sState", "=", "\"On\"", "if", "state", ...
Turns output on or off. Also turns hardware on ir off
[ "Turns", "output", "on", "or", "off", ".", "Also", "turns", "hardware", "on", "ir", "off" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L166-L181
249,313
zaturox/glin
glin/app.py
GlinApp.execute
def execute(self): """Execute Main Loop""" try: logging.debug("Entering IOLoop") self.loop.start() logging.debug("Leaving IOLoop") except KeyboardInterrupt: logging.debug("Leaving IOLoop by KeyboardInterrupt") finally: self.hw_c...
python
def execute(self): """Execute Main Loop""" try: logging.debug("Entering IOLoop") self.loop.start() logging.debug("Leaving IOLoop") except KeyboardInterrupt: logging.debug("Leaving IOLoop by KeyboardInterrupt") finally: self.hw_c...
[ "def", "execute", "(", "self", ")", ":", "try", ":", "logging", ".", "debug", "(", "\"Entering IOLoop\"", ")", "self", ".", "loop", ".", "start", "(", ")", "logging", ".", "debug", "(", "\"Leaving IOLoop\"", ")", "except", "KeyboardInterrupt", ":", "loggin...
Execute Main Loop
[ "Execute", "Main", "Loop" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L238-L247
249,314
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_brightness
def publish_brightness(self, brightness): """publish changed brightness""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.brightness(self.sequence_number, brightness)) return self.sequence_number
python
def publish_brightness(self, brightness): """publish changed brightness""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.brightness(self.sequence_number, brightness)) return self.sequence_number
[ "def", "publish_brightness", "(", "self", ",", "brightness", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "brightness", "(", "self", ".", "sequence_number", ",", ...
publish changed brightness
[ "publish", "changed", "brightness" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L263-L267
249,315
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_mainswitch_state
def publish_mainswitch_state(self, state): """publish changed mainswitch state""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.mainswitch_state(self.sequence_number, state)) return self.sequence_number
python
def publish_mainswitch_state(self, state): """publish changed mainswitch state""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.mainswitch_state(self.sequence_number, state)) return self.sequence_number
[ "def", "publish_mainswitch_state", "(", "self", ",", "state", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "mainswitch_state", "(", "self", ".", "sequence_number", ...
publish changed mainswitch state
[ "publish", "changed", "mainswitch", "state" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L268-L272
249,316
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_active_scene
def publish_active_scene(self, scene_id): """publish changed active scene""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_active(self.sequence_number, scene_id)) return self.sequence_number
python
def publish_active_scene(self, scene_id): """publish changed active scene""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_active(self.sequence_number, scene_id)) return self.sequence_number
[ "def", "publish_active_scene", "(", "self", ",", "scene_id", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "scene_active", "(", "self", ".", "sequence_number", ","...
publish changed active scene
[ "publish", "changed", "active", "scene" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L273-L277
249,317
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_scene_add
def publish_scene_add(self, scene_id, animation_id, name, color, velocity, config): """publish added scene""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_add(self.sequence_number, scene_id, animation_id, name, color, velocity, config)) return self.se...
python
def publish_scene_add(self, scene_id, animation_id, name, color, velocity, config): """publish added scene""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_add(self.sequence_number, scene_id, animation_id, name, color, velocity, config)) return self.se...
[ "def", "publish_scene_add", "(", "self", ",", "scene_id", ",", "animation_id", ",", "name", ",", "color", ",", "velocity", ",", "config", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", "."...
publish added scene
[ "publish", "added", "scene" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L278-L282
249,318
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_scene_remove
def publish_scene_remove(self, scene_id): """publish the removal of a scene""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_remove(self.sequence_number, scene_id)) return self.sequence_number
python
def publish_scene_remove(self, scene_id): """publish the removal of a scene""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_remove(self.sequence_number, scene_id)) return self.sequence_number
[ "def", "publish_scene_remove", "(", "self", ",", "scene_id", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "scene_remove", "(", "self", ".", "sequence_number", ","...
publish the removal of a scene
[ "publish", "the", "removal", "of", "a", "scene" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L283-L287
249,319
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_scene_name
def publish_scene_name(self, scene_id, name): """publish a changed scene name""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_name(self.sequence_number, scene_id, name)) return self.sequence_number
python
def publish_scene_name(self, scene_id, name): """publish a changed scene name""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_name(self.sequence_number, scene_id, name)) return self.sequence_number
[ "def", "publish_scene_name", "(", "self", ",", "scene_id", ",", "name", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "scene_name", "(", "self", ".", "sequence_n...
publish a changed scene name
[ "publish", "a", "changed", "scene", "name" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L288-L292
249,320
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_scene_config
def publish_scene_config(self, scene_id, config): """publish a changed scene configuration""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_config(self.sequence_number, scene_id, config)) return self.sequence_number
python
def publish_scene_config(self, scene_id, config): """publish a changed scene configuration""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_config(self.sequence_number, scene_id, config)) return self.sequence_number
[ "def", "publish_scene_config", "(", "self", ",", "scene_id", ",", "config", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "scene_config", "(", "self", ".", "sequ...
publish a changed scene configuration
[ "publish", "a", "changed", "scene", "configuration" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L293-L297
249,321
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_scene_color
def publish_scene_color(self, scene_id, color): """publish a changed scene color""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_color(self.sequence_number, scene_id, color)) return self.sequence_number
python
def publish_scene_color(self, scene_id, color): """publish a changed scene color""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_color(self.sequence_number, scene_id, color)) return self.sequence_number
[ "def", "publish_scene_color", "(", "self", ",", "scene_id", ",", "color", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "scene_color", "(", "self", ".", "sequenc...
publish a changed scene color
[ "publish", "a", "changed", "scene", "color" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L298-L302
249,322
zaturox/glin
glin/app.py
GlinAppZmqPublisher.publish_scene_velocity
def publish_scene_velocity(self, scene_id, velocity): """publish a changed scene velovity""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_velocity(self.sequence_number, scene_id, velocity)) return self.sequence_number
python
def publish_scene_velocity(self, scene_id, velocity): """publish a changed scene velovity""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_velocity(self.sequence_number, scene_id, velocity)) return self.sequence_number
[ "def", "publish_scene_velocity", "(", "self", ",", "scene_id", ",", "velocity", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "scene_velocity", "(", "self", ".", ...
publish a changed scene velovity
[ "publish", "a", "changed", "scene", "velovity" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L303-L307
249,323
zaturox/glin
glin/app.py
GlinAppZmqPublisher.handle_snapshot
def handle_snapshot(self, msg): """Handles a snapshot request""" logging.debug("Sending state snapshot request") identity = msg[0] self.snapshot.send_multipart([identity] + msgs.MessageBuilder.mainswitch_state(self.sequence_number, self.app.state.mainswitch)) self.snapshot.send_m...
python
def handle_snapshot(self, msg): """Handles a snapshot request""" logging.debug("Sending state snapshot request") identity = msg[0] self.snapshot.send_multipart([identity] + msgs.MessageBuilder.mainswitch_state(self.sequence_number, self.app.state.mainswitch)) self.snapshot.send_m...
[ "def", "handle_snapshot", "(", "self", ",", "msg", ")", ":", "logging", ".", "debug", "(", "\"Sending state snapshot request\"", ")", "identity", "=", "msg", "[", "0", "]", "self", ".", "snapshot", ".", "send_multipart", "(", "[", "identity", "]", "+", "ms...
Handles a snapshot request
[ "Handles", "a", "snapshot", "request" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L309-L321
249,324
zaturox/glin
glin/app.py
GlinAppZmqCollector.handle_collect
def handle_collect(self, msg): """handle an incoming message""" (success, sequence_number, comment) = self._handle_collect(msg) self.collector.send_multipart(msgs.MessageWriter().bool(success).uint64(sequence_number).string(comment).get())
python
def handle_collect(self, msg): """handle an incoming message""" (success, sequence_number, comment) = self._handle_collect(msg) self.collector.send_multipart(msgs.MessageWriter().bool(success).uint64(sequence_number).string(comment).get())
[ "def", "handle_collect", "(", "self", ",", "msg", ")", ":", "(", "success", ",", "sequence_number", ",", "comment", ")", "=", "self", ".", "_handle_collect", "(", "msg", ")", "self", ".", "collector", ".", "send_multipart", "(", "msgs", ".", "MessageWriter...
handle an incoming message
[ "handle", "an", "incoming", "message" ]
55214a579c4e4b4d74765f3f6aa2eb815bac1c3b
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L335-L338
249,325
opn-oss/opn-oss-py-common
opendna/common/decorators.py
with_uvloop_if_possible
def with_uvloop_if_possible(f, *args, **kwargs): """ Simple decorator to provide optional uvloop usage""" try: import uvloop import asyncio asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) print('uvloop will be used') except ImportError: print('uvloop unavailab...
python
def with_uvloop_if_possible(f, *args, **kwargs): """ Simple decorator to provide optional uvloop usage""" try: import uvloop import asyncio asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) print('uvloop will be used') except ImportError: print('uvloop unavailab...
[ "def", "with_uvloop_if_possible", "(", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "import", "uvloop", "import", "asyncio", "asyncio", ".", "set_event_loop_policy", "(", "uvloop", ".", "EventLoopPolicy", "(", ")", ")", "print", "(...
Simple decorator to provide optional uvloop usage
[ "Simple", "decorator", "to", "provide", "optional", "uvloop", "usage" ]
5d449a4328df3b050513eb74e9df4ddaef74caa8
https://github.com/opn-oss/opn-oss-py-common/blob/5d449a4328df3b050513eb74e9df4ddaef74caa8/opendna/common/decorators.py#L30-L39
249,326
jmgilman/Neolib
neolib/NST.py
NST.initialize
def initialize(): """ Initializes the global NST instance with the current NST and begins tracking """ NST.running = True pg = Page("http://www.neopets.com/") curtime = pg.find("td", {'id': 'nst'}).text NST.curTime = datetime.datetime.strptime(curtime.replace(" N...
python
def initialize(): """ Initializes the global NST instance with the current NST and begins tracking """ NST.running = True pg = Page("http://www.neopets.com/") curtime = pg.find("td", {'id': 'nst'}).text NST.curTime = datetime.datetime.strptime(curtime.replace(" N...
[ "def", "initialize", "(", ")", ":", "NST", ".", "running", "=", "True", "pg", "=", "Page", "(", "\"http://www.neopets.com/\"", ")", "curtime", "=", "pg", ".", "find", "(", "\"td\"", ",", "{", "'id'", ":", "'nst'", "}", ")", ".", "text", "NST", ".", ...
Initializes the global NST instance with the current NST and begins tracking
[ "Initializes", "the", "global", "NST", "instance", "with", "the", "current", "NST", "and", "begins", "tracking" ]
228fafeaed0f3195676137732384a14820ae285c
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/NST.py#L39-L50
249,327
limpyd/redis-limpyd-extensions
limpyd_extensions/dynamic/fields.py
DynamicFieldMixin._attach_to_model
def _attach_to_model(self, model): """ Check that the model can handle dynamic fields """ if not issubclass(model, ModelWithDynamicFieldMixin): raise ImplementationError( 'The "%s" model does not inherit from ModelWithDynamicFieldMixin ' 'so th...
python
def _attach_to_model(self, model): """ Check that the model can handle dynamic fields """ if not issubclass(model, ModelWithDynamicFieldMixin): raise ImplementationError( 'The "%s" model does not inherit from ModelWithDynamicFieldMixin ' 'so th...
[ "def", "_attach_to_model", "(", "self", ",", "model", ")", ":", "if", "not", "issubclass", "(", "model", ",", "ModelWithDynamicFieldMixin", ")", ":", "raise", "ImplementationError", "(", "'The \"%s\" model does not inherit from ModelWithDynamicFieldMixin '", "'so the \"%s\"...
Check that the model can handle dynamic fields
[ "Check", "that", "the", "model", "can", "handle", "dynamic", "fields" ]
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/dynamic/fields.py#L46-L64
249,328
limpyd/redis-limpyd-extensions
limpyd_extensions/dynamic/fields.py
DynamicFieldMixin.delete
def delete(self): """ If a dynamic version, delete it the standard way and remove it from the inventory, else delete all dynamic versions. """ if self.dynamic_version_of is None: self._delete_dynamic_versions() else: super(DynamicFieldMixin, self)....
python
def delete(self): """ If a dynamic version, delete it the standard way and remove it from the inventory, else delete all dynamic versions. """ if self.dynamic_version_of is None: self._delete_dynamic_versions() else: super(DynamicFieldMixin, self)....
[ "def", "delete", "(", "self", ")", ":", "if", "self", ".", "dynamic_version_of", "is", "None", ":", "self", ".", "_delete_dynamic_versions", "(", ")", "else", ":", "super", "(", "DynamicFieldMixin", ",", "self", ")", ".", "delete", "(", ")", "self", ".",...
If a dynamic version, delete it the standard way and remove it from the inventory, else delete all dynamic versions.
[ "If", "a", "dynamic", "version", "delete", "it", "the", "standard", "way", "and", "remove", "it", "from", "the", "inventory", "else", "delete", "all", "dynamic", "versions", "." ]
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/dynamic/fields.py#L165-L174
249,329
limpyd/redis-limpyd-extensions
limpyd_extensions/dynamic/fields.py
DynamicFieldMixin._delete_dynamic_versions
def _delete_dynamic_versions(self): """ Call the `delete` method of all dynamic versions of the current field found in the inventory then clean the inventory. """ if self.dynamic_version_of: raise ImplementationError(u'"_delete_dynamic_versions" can only be ' ...
python
def _delete_dynamic_versions(self): """ Call the `delete` method of all dynamic versions of the current field found in the inventory then clean the inventory. """ if self.dynamic_version_of: raise ImplementationError(u'"_delete_dynamic_versions" can only be ' ...
[ "def", "_delete_dynamic_versions", "(", "self", ")", ":", "if", "self", ".", "dynamic_version_of", ":", "raise", "ImplementationError", "(", "u'\"_delete_dynamic_versions\" can only be '", "u'executed on the base field'", ")", "inventory", "=", "self", ".", "_inventory", ...
Call the `delete` method of all dynamic versions of the current field found in the inventory then clean the inventory.
[ "Call", "the", "delete", "method", "of", "all", "dynamic", "versions", "of", "the", "current", "field", "found", "in", "the", "inventory", "then", "clean", "the", "inventory", "." ]
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/dynamic/fields.py#L176-L196
249,330
limpyd/redis-limpyd-extensions
limpyd_extensions/dynamic/fields.py
DynamicFieldMixin.get_name_for
def get_name_for(self, dynamic_part): """ Compute the name of the variation of the current dynamic field based on the given dynamic part. Use the "format" attribute to create the final name. """ name = self.format % dynamic_part if not self._accept_name(name): ...
python
def get_name_for(self, dynamic_part): """ Compute the name of the variation of the current dynamic field based on the given dynamic part. Use the "format" attribute to create the final name. """ name = self.format % dynamic_part if not self._accept_name(name): ...
[ "def", "get_name_for", "(", "self", ",", "dynamic_part", ")", ":", "name", "=", "self", ".", "format", "%", "dynamic_part", "if", "not", "self", ".", "_accept_name", "(", "name", ")", ":", "raise", "ImplementationError", "(", "'It seems that pattern and format d...
Compute the name of the variation of the current dynamic field based on the given dynamic part. Use the "format" attribute to create the final name.
[ "Compute", "the", "name", "of", "the", "variation", "of", "the", "current", "dynamic", "field", "based", "on", "the", "given", "dynamic", "part", ".", "Use", "the", "format", "attribute", "to", "create", "the", "final", "name", "." ]
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/dynamic/fields.py#L198-L208
249,331
limpyd/redis-limpyd-extensions
limpyd_extensions/dynamic/fields.py
DynamicFieldMixin.get_for
def get_for(self, dynamic_part): """ Return a variation of the current dynamic field based on the given dynamic part. Use the "format" attribute to create the final name """ if not hasattr(self, '_instance'): raise ImplementationError('"get_for" can be used only on a ...
python
def get_for(self, dynamic_part): """ Return a variation of the current dynamic field based on the given dynamic part. Use the "format" attribute to create the final name """ if not hasattr(self, '_instance'): raise ImplementationError('"get_for" can be used only on a ...
[ "def", "get_for", "(", "self", ",", "dynamic_part", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_instance'", ")", ":", "raise", "ImplementationError", "(", "'\"get_for\" can be used only on a bound field'", ")", "name", "=", "self", ".", "get_name_for", ...
Return a variation of the current dynamic field based on the given dynamic part. Use the "format" attribute to create the final name
[ "Return", "a", "variation", "of", "the", "current", "dynamic", "field", "based", "on", "the", "given", "dynamic", "part", ".", "Use", "the", "format", "attribute", "to", "create", "the", "final", "name" ]
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/dynamic/fields.py#L210-L218
249,332
shaypal5/decore
decore/decore.py
threadsafe_generator
def threadsafe_generator(generator_func): """A decorator that takes a generator function and makes it thread-safe. """ def decoration(*args, **keyword_args): """A thread-safe decoration for a generator function.""" return ThreadSafeIter(generator_func(*args, **keyword_args)) return decor...
python
def threadsafe_generator(generator_func): """A decorator that takes a generator function and makes it thread-safe. """ def decoration(*args, **keyword_args): """A thread-safe decoration for a generator function.""" return ThreadSafeIter(generator_func(*args, **keyword_args)) return decor...
[ "def", "threadsafe_generator", "(", "generator_func", ")", ":", "def", "decoration", "(", "*", "args", ",", "*", "*", "keyword_args", ")", ":", "\"\"\"A thread-safe decoration for a generator function.\"\"\"", "return", "ThreadSafeIter", "(", "generator_func", "(", "*",...
A decorator that takes a generator function and makes it thread-safe.
[ "A", "decorator", "that", "takes", "a", "generator", "function", "and", "makes", "it", "thread", "-", "safe", "." ]
460f22f8b9127e6a80b161a626d8827673343afb
https://github.com/shaypal5/decore/blob/460f22f8b9127e6a80b161a626d8827673343afb/decore/decore.py#L24-L30
249,333
shaypal5/decore
decore/decore.py
lazy_property
def lazy_property(function): """Cache the first return value of a function for all subsequent calls. This decorator is usefull for argument-less functions that behave more like a global or static property that should be calculated once, but lazily (i.e. only if requested). """ cached_val = [] ...
python
def lazy_property(function): """Cache the first return value of a function for all subsequent calls. This decorator is usefull for argument-less functions that behave more like a global or static property that should be calculated once, but lazily (i.e. only if requested). """ cached_val = [] ...
[ "def", "lazy_property", "(", "function", ")", ":", "cached_val", "=", "[", "]", "def", "_wrapper", "(", "*", "args", ")", ":", "try", ":", "return", "cached_val", "[", "0", "]", "except", "IndexError", ":", "ret_val", "=", "function", "(", "*", "args",...
Cache the first return value of a function for all subsequent calls. This decorator is usefull for argument-less functions that behave more like a global or static property that should be calculated once, but lazily (i.e. only if requested).
[ "Cache", "the", "first", "return", "value", "of", "a", "function", "for", "all", "subsequent", "calls", "." ]
460f22f8b9127e6a80b161a626d8827673343afb
https://github.com/shaypal5/decore/blob/460f22f8b9127e6a80b161a626d8827673343afb/decore/decore.py#L33-L48
249,334
hitchtest/hitchserve
hitchserve/service_logs.py
Tail.cat
def cat(self, numlines=None): """Return a list of lines output by this service.""" if len(self.titles) == 1: lines = self.lines() if numlines is not None: lines = lines[len(lines)-numlines:] log("\n".join(lines)) else: lines = [self...
python
def cat(self, numlines=None): """Return a list of lines output by this service.""" if len(self.titles) == 1: lines = self.lines() if numlines is not None: lines = lines[len(lines)-numlines:] log("\n".join(lines)) else: lines = [self...
[ "def", "cat", "(", "self", ",", "numlines", "=", "None", ")", ":", "if", "len", "(", "self", ".", "titles", ")", "==", "1", ":", "lines", "=", "self", ".", "lines", "(", ")", "if", "numlines", "is", "not", "None", ":", "lines", "=", "lines", "[...
Return a list of lines output by this service.
[ "Return", "a", "list", "of", "lines", "output", "by", "this", "service", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_logs.py#L162-L173
249,335
hitchtest/hitchserve
hitchserve/service_logs.py
SubLog._match_service
def _match_service(self, line_with_color): """Return line if line matches this service's name, return None otherwise.""" line = re.compile("(\x1b\[\d+m)+").sub("", line_with_color) # Strip color codes regexp = re.compile(r"^\[(.*?)\]\s(.*?)$") if regexp.match(line): t...
python
def _match_service(self, line_with_color): """Return line if line matches this service's name, return None otherwise.""" line = re.compile("(\x1b\[\d+m)+").sub("", line_with_color) # Strip color codes regexp = re.compile(r"^\[(.*?)\]\s(.*?)$") if regexp.match(line): t...
[ "def", "_match_service", "(", "self", ",", "line_with_color", ")", ":", "line", "=", "re", ".", "compile", "(", "\"(\\x1b\\[\\d+m)+\"", ")", ".", "sub", "(", "\"\"", ",", "line_with_color", ")", "# Strip color codes", "regexp", "=", "re", ".", "compile", "("...
Return line if line matches this service's name, return None otherwise.
[ "Return", "line", "if", "line", "matches", "this", "service", "s", "name", "return", "None", "otherwise", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_logs.py#L183-L192
249,336
hitchtest/hitchserve
hitchserve/service_logs.py
SubLog.json
def json(self): """Return a list of JSON objects output by this service.""" lines = [] for line in self.lines(): try: if len(line) == 1: lines.append(json.loads(line, strict=False)) else: lines.append(json.loads(...
python
def json(self): """Return a list of JSON objects output by this service.""" lines = [] for line in self.lines(): try: if len(line) == 1: lines.append(json.loads(line, strict=False)) else: lines.append(json.loads(...
[ "def", "json", "(", "self", ")", ":", "lines", "=", "[", "]", "for", "line", "in", "self", ".", "lines", "(", ")", ":", "try", ":", "if", "len", "(", "line", ")", "==", "1", ":", "lines", ".", "append", "(", "json", ".", "loads", "(", "line",...
Return a list of JSON objects output by this service.
[ "Return", "a", "list", "of", "JSON", "objects", "output", "by", "this", "service", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_logs.py#L216-L227
249,337
cogniteev/docido-python-sdk
docido_sdk/toolbox/contextlib_ext.py
restore_dict_kv
def restore_dict_kv(a_dict, key, copy_func=copy.deepcopy): """Backup an object in a with context and restore it when leaving the scope. :param a_dict: associative table :param: key key whose value has to be backed up :param copy_func: callbable object used to create an object copy. ...
python
def restore_dict_kv(a_dict, key, copy_func=copy.deepcopy): """Backup an object in a with context and restore it when leaving the scope. :param a_dict: associative table :param: key key whose value has to be backed up :param copy_func: callbable object used to create an object copy. ...
[ "def", "restore_dict_kv", "(", "a_dict", ",", "key", ",", "copy_func", "=", "copy", ".", "deepcopy", ")", ":", "exists", "=", "False", "if", "key", "in", "a_dict", ":", "backup", "=", "copy_func", "(", "a_dict", "[", "key", "]", ")", "exists", "=", "...
Backup an object in a with context and restore it when leaving the scope. :param a_dict: associative table :param: key key whose value has to be backed up :param copy_func: callbable object used to create an object copy. default is `copy.deepcopy`
[ "Backup", "an", "object", "in", "a", "with", "context", "and", "restore", "it", "when", "leaving", "the", "scope", "." ]
58ecb6c6f5757fd40c0601657ab18368da7ddf33
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/contextlib_ext.py#L13-L34
249,338
cogniteev/docido-python-sdk
docido_sdk/toolbox/contextlib_ext.py
popen
def popen(*args, **kwargs): """Run a process in background in a `with` context. Parameters given to this function are passed to `subprocess.Popen`. Process is kill when exiting the context. """ process = subprocess.Popen(*args, **kwargs) try: yield process.pid finally: os.kil...
python
def popen(*args, **kwargs): """Run a process in background in a `with` context. Parameters given to this function are passed to `subprocess.Popen`. Process is kill when exiting the context. """ process = subprocess.Popen(*args, **kwargs) try: yield process.pid finally: os.kil...
[ "def", "popen", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "process", "=", "subprocess", ".", "Popen", "(", "*", "args", ",", "*", "*", "kwargs", ")", "try", ":", "yield", "process", ".", "pid", "finally", ":", "os", ".", "kill", "(", ...
Run a process in background in a `with` context. Parameters given to this function are passed to `subprocess.Popen`. Process is kill when exiting the context.
[ "Run", "a", "process", "in", "background", "in", "a", "with", "context", ".", "Parameters", "given", "to", "this", "function", "are", "passed", "to", "subprocess", ".", "Popen", ".", "Process", "is", "kill", "when", "exiting", "the", "context", "." ]
58ecb6c6f5757fd40c0601657ab18368da7ddf33
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/contextlib_ext.py#L80-L90
249,339
EventTeam/beliefs
src/beliefs/cells/lists.py
LinearOrderedCell.coerce
def coerce(self, value): """ Takes one or two values in the domain and returns a LinearOrderedCell with the same domain """ if isinstance(value, LinearOrderedCell) and (self.domain == value.domain or \ list_diff(self.domain, value.domain) == []): # is Line...
python
def coerce(self, value): """ Takes one or two values in the domain and returns a LinearOrderedCell with the same domain """ if isinstance(value, LinearOrderedCell) and (self.domain == value.domain or \ list_diff(self.domain, value.domain) == []): # is Line...
[ "def", "coerce", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "LinearOrderedCell", ")", "and", "(", "self", ".", "domain", "==", "value", ".", "domain", "or", "list_diff", "(", "self", ".", "domain", ",", "value", ".", ...
Takes one or two values in the domain and returns a LinearOrderedCell with the same domain
[ "Takes", "one", "or", "two", "values", "in", "the", "domain", "and", "returns", "a", "LinearOrderedCell", "with", "the", "same", "domain" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/lists.py#L44-L64
249,340
EventTeam/beliefs
src/beliefs/cells/lists.py
ListCell.coerce
def coerce(value): """ Turns a value into a list """ if isinstance(value, ListCell): return value elif isinstance(value, (list)): return ListCell(value) else: return ListCell([value])
python
def coerce(value): """ Turns a value into a list """ if isinstance(value, ListCell): return value elif isinstance(value, (list)): return ListCell(value) else: return ListCell([value])
[ "def", "coerce", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "ListCell", ")", ":", "return", "value", "elif", "isinstance", "(", "value", ",", "(", "list", ")", ")", ":", "return", "ListCell", "(", "value", ")", "else", ":", "retur...
Turns a value into a list
[ "Turns", "a", "value", "into", "a", "list" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/lists.py#L160-L169
249,341
EventTeam/beliefs
src/beliefs/cells/lists.py
ListCell.append
def append(self, el): """ Idiosynractic method for adding an element to a list """ if self.value is None: self.value = [el] else: self.value.append(el)
python
def append(self, el): """ Idiosynractic method for adding an element to a list """ if self.value is None: self.value = [el] else: self.value.append(el)
[ "def", "append", "(", "self", ",", "el", ")", ":", "if", "self", ".", "value", "is", "None", ":", "self", ".", "value", "=", "[", "el", "]", "else", ":", "self", ".", "value", ".", "append", "(", "el", ")" ]
Idiosynractic method for adding an element to a list
[ "Idiosynractic", "method", "for", "adding", "an", "element", "to", "a", "list" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/lists.py#L268-L275
249,342
EventTeam/beliefs
src/beliefs/cells/lists.py
PrefixCell.merge
def merge(self, other): """ Merges two prefixes """ other = PrefixCell.coerce(other) if self.is_equal(other): # pick among dependencies return self elif other.is_entailed_by(self): return self elif self.is_entailed_by(other): ...
python
def merge(self, other): """ Merges two prefixes """ other = PrefixCell.coerce(other) if self.is_equal(other): # pick among dependencies return self elif other.is_entailed_by(self): return self elif self.is_entailed_by(other): ...
[ "def", "merge", "(", "self", ",", "other", ")", ":", "other", "=", "PrefixCell", ".", "coerce", "(", "other", ")", "if", "self", ".", "is_equal", "(", "other", ")", ":", "# pick among dependencies", "return", "self", "elif", "other", ".", "is_entailed_by",...
Merges two prefixes
[ "Merges", "two", "prefixes" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/lists.py#L304-L323
249,343
sternoru/goscalecms
goscale/templatetags/goscale_tags.py
GoscaleTemplateInclusionTag.get_template
def get_template(self, context, **kwargs): """ Returns the template to be used for the current context and arguments. """ if 'template' in kwargs['params']: self.template = kwargs['params']['template'] return super(GoscaleTemplateInclusionTag, self).get_template(conte...
python
def get_template(self, context, **kwargs): """ Returns the template to be used for the current context and arguments. """ if 'template' in kwargs['params']: self.template = kwargs['params']['template'] return super(GoscaleTemplateInclusionTag, self).get_template(conte...
[ "def", "get_template", "(", "self", ",", "context", ",", "*", "*", "kwargs", ")", ":", "if", "'template'", "in", "kwargs", "[", "'params'", "]", ":", "self", ".", "template", "=", "kwargs", "[", "'params'", "]", "[", "'template'", "]", "return", "super...
Returns the template to be used for the current context and arguments.
[ "Returns", "the", "template", "to", "be", "used", "for", "the", "current", "context", "and", "arguments", "." ]
7eee50357c47ebdfe3e573a8b4be3b67892d229e
https://github.com/sternoru/goscalecms/blob/7eee50357c47ebdfe3e573a8b4be3b67892d229e/goscale/templatetags/goscale_tags.py#L27-L33
249,344
minhhoit/yacms
yacms/generic/views.py
admin_keywords_submit
def admin_keywords_submit(request): """ Adds any new given keywords from the custom keywords field in the admin, and returns their IDs for use when saving a model with a keywords field. """ keyword_ids, titles = [], [] remove = punctuation.replace("-", "") # Strip punctuation, allow dashes....
python
def admin_keywords_submit(request): """ Adds any new given keywords from the custom keywords field in the admin, and returns their IDs for use when saving a model with a keywords field. """ keyword_ids, titles = [], [] remove = punctuation.replace("-", "") # Strip punctuation, allow dashes....
[ "def", "admin_keywords_submit", "(", "request", ")", ":", "keyword_ids", ",", "titles", "=", "[", "]", ",", "[", "]", "remove", "=", "punctuation", ".", "replace", "(", "\"-\"", ",", "\"\"", ")", "# Strip punctuation, allow dashes.", "for", "title", "in", "r...
Adds any new given keywords from the custom keywords field in the admin, and returns their IDs for use when saving a model with a keywords field.
[ "Adds", "any", "new", "given", "keywords", "from", "the", "custom", "keywords", "field", "in", "the", "admin", "and", "returns", "their", "IDs", "for", "use", "when", "saving", "a", "model", "with", "a", "keywords", "field", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/generic/views.py#L26-L43
249,345
minhhoit/yacms
yacms/generic/views.py
comment
def comment(request, template="generic/comments.html", extra_context=None): """ Handle a ``ThreadedCommentForm`` submission and redirect back to its related object. """ response = initial_validation(request, "comment") if isinstance(response, HttpResponse): return response obj, post_...
python
def comment(request, template="generic/comments.html", extra_context=None): """ Handle a ``ThreadedCommentForm`` submission and redirect back to its related object. """ response = initial_validation(request, "comment") if isinstance(response, HttpResponse): return response obj, post_...
[ "def", "comment", "(", "request", ",", "template", "=", "\"generic/comments.html\"", ",", "extra_context", "=", "None", ")", ":", "response", "=", "initial_validation", "(", "request", ",", "\"comment\"", ")", "if", "isinstance", "(", "response", ",", "HttpRespo...
Handle a ``ThreadedCommentForm`` submission and redirect back to its related object.
[ "Handle", "a", "ThreadedCommentForm", "submission", "and", "redirect", "back", "to", "its", "related", "object", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/generic/views.py#L91-L119
249,346
minhhoit/yacms
yacms/generic/views.py
rating
def rating(request): """ Handle a ``RatingForm`` submission and redirect back to its related object. """ response = initial_validation(request, "rating") if isinstance(response, HttpResponse): return response obj, post_data = response url = add_cache_bypass(obj.get_absolute_url()...
python
def rating(request): """ Handle a ``RatingForm`` submission and redirect back to its related object. """ response = initial_validation(request, "rating") if isinstance(response, HttpResponse): return response obj, post_data = response url = add_cache_bypass(obj.get_absolute_url()...
[ "def", "rating", "(", "request", ")", ":", "response", "=", "initial_validation", "(", "request", ",", "\"rating\"", ")", "if", "isinstance", "(", "response", ",", "HttpResponse", ")", ":", "return", "response", "obj", ",", "post_data", "=", "response", "url...
Handle a ``RatingForm`` submission and redirect back to its related object.
[ "Handle", "a", "RatingForm", "submission", "and", "redirect", "back", "to", "its", "related", "object", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/generic/views.py#L122-L149
249,347
clld/cdstarcat
src/cdstarcat/catalog.py
Catalog.add
def add(self, obj, metadata=None, update=False): """ Add an existing CDSTAR object to the catalog. :param obj: A pycdstar.resource.Object instance """ if (obj not in self) or update: self[obj.id] = Object.fromdict( obj.id, dict( ...
python
def add(self, obj, metadata=None, update=False): """ Add an existing CDSTAR object to the catalog. :param obj: A pycdstar.resource.Object instance """ if (obj not in self) or update: self[obj.id] = Object.fromdict( obj.id, dict( ...
[ "def", "add", "(", "self", ",", "obj", ",", "metadata", "=", "None", ",", "update", "=", "False", ")", ":", "if", "(", "obj", "not", "in", "self", ")", "or", "update", ":", "self", "[", "obj", ".", "id", "]", "=", "Object", ".", "fromdict", "("...
Add an existing CDSTAR object to the catalog. :param obj: A pycdstar.resource.Object instance
[ "Add", "an", "existing", "CDSTAR", "object", "to", "the", "catalog", "." ]
41f33f59cdde5e30835d2f3accf2d1fbe5332cab
https://github.com/clld/cdstarcat/blob/41f33f59cdde5e30835d2f3accf2d1fbe5332cab/src/cdstarcat/catalog.py#L175-L188
249,348
clld/cdstarcat
src/cdstarcat/catalog.py
Catalog.delete
def delete(self, obj): """ Delete an object in CDSTAR and remove it from the catalog. :param obj: An object ID or an Object instance. """ obj = self.api.get_object(getattr(obj, 'id', obj)) obj.delete() self.remove(obj.id)
python
def delete(self, obj): """ Delete an object in CDSTAR and remove it from the catalog. :param obj: An object ID or an Object instance. """ obj = self.api.get_object(getattr(obj, 'id', obj)) obj.delete() self.remove(obj.id)
[ "def", "delete", "(", "self", ",", "obj", ")", ":", "obj", "=", "self", ".", "api", ".", "get_object", "(", "getattr", "(", "obj", ",", "'id'", ",", "obj", ")", ")", "obj", ".", "delete", "(", ")", "self", ".", "remove", "(", "obj", ".", "id", ...
Delete an object in CDSTAR and remove it from the catalog. :param obj: An object ID or an Object instance.
[ "Delete", "an", "object", "in", "CDSTAR", "and", "remove", "it", "from", "the", "catalog", "." ]
41f33f59cdde5e30835d2f3accf2d1fbe5332cab
https://github.com/clld/cdstarcat/blob/41f33f59cdde5e30835d2f3accf2d1fbe5332cab/src/cdstarcat/catalog.py#L200-L208
249,349
clld/cdstarcat
src/cdstarcat/catalog.py
Catalog.create
def create(self, path, metadata, filter_=filter_hidden, object_class=None): """ Create objects in CDSTAR and register them in the catalog. Note that we guess the mimetype based on the filename extension, using `mimetypes.guess_type`. Thus, it is the caller's responsibility to add custom...
python
def create(self, path, metadata, filter_=filter_hidden, object_class=None): """ Create objects in CDSTAR and register them in the catalog. Note that we guess the mimetype based on the filename extension, using `mimetypes.guess_type`. Thus, it is the caller's responsibility to add custom...
[ "def", "create", "(", "self", ",", "path", ",", "metadata", ",", "filter_", "=", "filter_hidden", ",", "object_class", "=", "None", ")", ":", "path", "=", "Path", "(", "path", ")", "if", "path", ".", "is_file", "(", ")", ":", "fnames", "=", "[", "p...
Create objects in CDSTAR and register them in the catalog. Note that we guess the mimetype based on the filename extension, using `mimetypes.guess_type`. Thus, it is the caller's responsibility to add custom or otherwise uncommon types to the list of known types using `mimetypes.add_type`. ...
[ "Create", "objects", "in", "CDSTAR", "and", "register", "them", "in", "the", "catalog", "." ]
41f33f59cdde5e30835d2f3accf2d1fbe5332cab
https://github.com/clld/cdstarcat/blob/41f33f59cdde5e30835d2f3accf2d1fbe5332cab/src/cdstarcat/catalog.py#L210-L233
249,350
eddiejessup/spatious
spatious/distance.py
csep_close
def csep_close(ra, rb): """Return the closest separation vector between each point in one set, and every point in a second set. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. `ra` is the set of points from which the closest ...
python
def csep_close(ra, rb): """Return the closest separation vector between each point in one set, and every point in a second set. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. `ra` is the set of points from which the closest ...
[ "def", "csep_close", "(", "ra", ",", "rb", ")", ":", "seps", "=", "csep", "(", "ra", ",", "rb", ")", "seps_sq", "=", "np", ".", "sum", "(", "np", ".", "square", "(", "seps", ")", ",", "axis", "=", "-", "1", ")", "i_close", "=", "np", ".", "...
Return the closest separation vector between each point in one set, and every point in a second set. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. `ra` is the set of points from which the closest separation vectors to points...
[ "Return", "the", "closest", "separation", "vector", "between", "each", "point", "in", "one", "set", "and", "every", "point", "in", "a", "second", "set", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/distance.py#L28-L53
249,351
eddiejessup/spatious
spatious/distance.py
csep_periodic
def csep_periodic(ra, rb, L): """Return separation vectors between each pair of the two sets of points. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. L: float array, shape (d,) System lengths. Returns ------- ...
python
def csep_periodic(ra, rb, L): """Return separation vectors between each pair of the two sets of points. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. L: float array, shape (d,) System lengths. Returns ------- ...
[ "def", "csep_periodic", "(", "ra", ",", "rb", ",", "L", ")", ":", "seps", "=", "ra", "[", ":", ",", "np", ".", "newaxis", ",", ":", "]", "-", "rb", "[", "np", ".", "newaxis", ",", ":", ",", ":", "]", "for", "i_dim", "in", "range", "(", "ra"...
Return separation vectors between each pair of the two sets of points. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. L: float array, shape (d,) System lengths. Returns ------- csep: float array-like, shape (n, m...
[ "Return", "separation", "vectors", "between", "each", "pair", "of", "the", "two", "sets", "of", "points", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/distance.py#L56-L77
249,352
eddiejessup/spatious
spatious/distance.py
csep_periodic_close
def csep_periodic_close(ra, rb, L): """Return the closest separation vector between each point in one set, and every point in a second set, in periodic space. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. `ra` is the set of poin...
python
def csep_periodic_close(ra, rb, L): """Return the closest separation vector between each point in one set, and every point in a second set, in periodic space. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. `ra` is the set of poin...
[ "def", "csep_periodic_close", "(", "ra", ",", "rb", ",", "L", ")", ":", "seps", "=", "csep_periodic", "(", "ra", ",", "rb", ",", "L", ")", "seps_sq", "=", "np", ".", "sum", "(", "np", ".", "square", "(", "seps", ")", ",", "axis", "=", "-", "1",...
Return the closest separation vector between each point in one set, and every point in a second set, in periodic space. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. `ra` is the set of points from which the closest separatio...
[ "Return", "the", "closest", "separation", "vector", "between", "each", "point", "in", "one", "set", "and", "every", "point", "in", "a", "second", "set", "in", "periodic", "space", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/distance.py#L80-L107
249,353
eddiejessup/spatious
spatious/distance.py
cdist_sq_periodic
def cdist_sq_periodic(ra, rb, L): """Return the squared distance between each point in on set, and every point in a second set, in periodic space. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. L: float array, shape (d,) ...
python
def cdist_sq_periodic(ra, rb, L): """Return the squared distance between each point in on set, and every point in a second set, in periodic space. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. L: float array, shape (d,) ...
[ "def", "cdist_sq_periodic", "(", "ra", ",", "rb", ",", "L", ")", ":", "return", "np", ".", "sum", "(", "np", ".", "square", "(", "csep_periodic", "(", "ra", ",", "rb", ",", "L", ")", ")", ",", "axis", "=", "-", "1", ")" ]
Return the squared distance between each point in on set, and every point in a second set, in periodic space. Parameters ---------- ra, rb: float array-like, shape (n, d) and (m, d) in d dimensions. Two sets of points. L: float array, shape (d,) System lengths. Returns ----...
[ "Return", "the", "squared", "distance", "between", "each", "point", "in", "on", "set", "and", "every", "point", "in", "a", "second", "set", "in", "periodic", "space", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/distance.py#L110-L126
249,354
eddiejessup/spatious
spatious/distance.py
pdist_sq_periodic
def pdist_sq_periodic(r, L): """Return the squared distance between all combinations of a set of points, in periodic space. Parameters ---------- r: shape (n, d) for n points in d dimensions. Set of points L: float array, shape (d,) System lengths. Returns ------- d...
python
def pdist_sq_periodic(r, L): """Return the squared distance between all combinations of a set of points, in periodic space. Parameters ---------- r: shape (n, d) for n points in d dimensions. Set of points L: float array, shape (d,) System lengths. Returns ------- d...
[ "def", "pdist_sq_periodic", "(", "r", ",", "L", ")", ":", "d", "=", "csep_periodic", "(", "r", ",", "r", ",", "L", ")", "d", "[", "np", ".", "identity", "(", "len", "(", "r", ")", ",", "dtype", "=", "np", ".", "bool", ")", "]", "=", "np", "...
Return the squared distance between all combinations of a set of points, in periodic space. Parameters ---------- r: shape (n, d) for n points in d dimensions. Set of points L: float array, shape (d,) System lengths. Returns ------- d_sq: float array, shape (n, n, d) ...
[ "Return", "the", "squared", "distance", "between", "all", "combinations", "of", "a", "set", "of", "points", "in", "periodic", "space", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/distance.py#L129-L148
249,355
eddiejessup/spatious
spatious/distance.py
angular_distance
def angular_distance(n1, n2): """Return the angular separation between two 3 dimensional vectors. Parameters ---------- n1, n2: array-like, shape (3,) Coordinates of two vectors. Their magnitude does not matter. Returns ------- d_sigma: float Angle between n1 and n2...
python
def angular_distance(n1, n2): """Return the angular separation between two 3 dimensional vectors. Parameters ---------- n1, n2: array-like, shape (3,) Coordinates of two vectors. Their magnitude does not matter. Returns ------- d_sigma: float Angle between n1 and n2...
[ "def", "angular_distance", "(", "n1", ",", "n2", ")", ":", "return", "np", ".", "arctan2", "(", "vector", ".", "vector_mag", "(", "np", ".", "cross", "(", "n1", ",", "n2", ")", ")", ",", "np", ".", "dot", "(", "n1", ",", "n2", ")", ")" ]
Return the angular separation between two 3 dimensional vectors. Parameters ---------- n1, n2: array-like, shape (3,) Coordinates of two vectors. Their magnitude does not matter. Returns ------- d_sigma: float Angle between n1 and n2 in radians.
[ "Return", "the", "angular", "separation", "between", "two", "3", "dimensional", "vectors", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/distance.py#L151-L165
249,356
treycucco/bidon
bidon/field_mapping.py
FieldMapping.get_namedtuple
def get_namedtuple(cls, field_mappings, name="Record"): """Gets a namedtuple class that matches the destination_names in the list of field_mappings.""" return namedtuple(name, [fm.destination_name for fm in field_mappings])
python
def get_namedtuple(cls, field_mappings, name="Record"): """Gets a namedtuple class that matches the destination_names in the list of field_mappings.""" return namedtuple(name, [fm.destination_name for fm in field_mappings])
[ "def", "get_namedtuple", "(", "cls", ",", "field_mappings", ",", "name", "=", "\"Record\"", ")", ":", "return", "namedtuple", "(", "name", ",", "[", "fm", ".", "destination_name", "for", "fm", "in", "field_mappings", "]", ")" ]
Gets a namedtuple class that matches the destination_names in the list of field_mappings.
[ "Gets", "a", "namedtuple", "class", "that", "matches", "the", "destination_names", "in", "the", "list", "of", "field_mappings", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/field_mapping.py#L43-L45
249,357
treycucco/bidon
bidon/field_mapping.py
FieldMapping.transfer
def transfer(cls, field_mappings, source, destination_factory): """Convert a record to a dictionary via field_mappings, and pass that to destination_factory.""" data = dict() for index, field_mapping in enumerate(field_mappings): try: data[field_mapping.destination_name] = field_mapping.get_va...
python
def transfer(cls, field_mappings, source, destination_factory): """Convert a record to a dictionary via field_mappings, and pass that to destination_factory.""" data = dict() for index, field_mapping in enumerate(field_mappings): try: data[field_mapping.destination_name] = field_mapping.get_va...
[ "def", "transfer", "(", "cls", ",", "field_mappings", ",", "source", ",", "destination_factory", ")", ":", "data", "=", "dict", "(", ")", "for", "index", ",", "field_mapping", "in", "enumerate", "(", "field_mappings", ")", ":", "try", ":", "data", "[", "...
Convert a record to a dictionary via field_mappings, and pass that to destination_factory.
[ "Convert", "a", "record", "to", "a", "dictionary", "via", "field_mappings", "and", "pass", "that", "to", "destination_factory", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/field_mapping.py#L56-L68
249,358
treycucco/bidon
bidon/field_mapping.py
FieldMapping.transfer_all
def transfer_all(cls, field_mappings, sources, destination_factory=None): """Calls cls.transfer on all records in sources.""" for index, source in enumerate(sources): try: yield cls.transfer(field_mappings, source, destination_factory or (lambda x: x)) except Exception as ex: raise E...
python
def transfer_all(cls, field_mappings, sources, destination_factory=None): """Calls cls.transfer on all records in sources.""" for index, source in enumerate(sources): try: yield cls.transfer(field_mappings, source, destination_factory or (lambda x: x)) except Exception as ex: raise E...
[ "def", "transfer_all", "(", "cls", ",", "field_mappings", ",", "sources", ",", "destination_factory", "=", "None", ")", ":", "for", "index", ",", "source", "in", "enumerate", "(", "sources", ")", ":", "try", ":", "yield", "cls", ".", "transfer", "(", "fi...
Calls cls.transfer on all records in sources.
[ "Calls", "cls", ".", "transfer", "on", "all", "records", "in", "sources", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/field_mapping.py#L71-L77
249,359
cogniteev/yamlious
yamlious/__init__.py
merge_dict
def merge_dict(lhs, rhs): """ Merge content of a dict in another :param: dict: lhs dict where is merged the second one :param: dict: rhs dict whose content is merged """ assert isinstance(lhs, dict) assert isinstance(rhs, dict) for k, v in rhs.iteritems(): if k not in lh...
python
def merge_dict(lhs, rhs): """ Merge content of a dict in another :param: dict: lhs dict where is merged the second one :param: dict: rhs dict whose content is merged """ assert isinstance(lhs, dict) assert isinstance(rhs, dict) for k, v in rhs.iteritems(): if k not in lh...
[ "def", "merge_dict", "(", "lhs", ",", "rhs", ")", ":", "assert", "isinstance", "(", "lhs", ",", "dict", ")", "assert", "isinstance", "(", "rhs", ",", "dict", ")", "for", "k", ",", "v", "in", "rhs", ".", "iteritems", "(", ")", ":", "if", "k", "not...
Merge content of a dict in another :param: dict: lhs dict where is merged the second one :param: dict: rhs dict whose content is merged
[ "Merge", "content", "of", "a", "dict", "in", "another" ]
fc6a603367c2135b43ef2356959963d9dccbb25a
https://github.com/cogniteev/yamlious/blob/fc6a603367c2135b43ef2356959963d9dccbb25a/yamlious/__init__.py#L21-L36
249,360
cogniteev/yamlious
yamlious/__init__.py
from_yaml
def from_yaml(*streams): """ Build voluptuous.Schema function parameters from a streams of YAMLs """ return from_dict(merge_dicts(*map( lambda f: yaml.load(f, Loader=Loader), list(streams) )))
python
def from_yaml(*streams): """ Build voluptuous.Schema function parameters from a streams of YAMLs """ return from_dict(merge_dicts(*map( lambda f: yaml.load(f, Loader=Loader), list(streams) )))
[ "def", "from_yaml", "(", "*", "streams", ")", ":", "return", "from_dict", "(", "merge_dicts", "(", "*", "map", "(", "lambda", "f", ":", "yaml", ".", "load", "(", "f", ",", "Loader", "=", "Loader", ")", ",", "list", "(", "streams", ")", ")", ")", ...
Build voluptuous.Schema function parameters from a streams of YAMLs
[ "Build", "voluptuous", ".", "Schema", "function", "parameters", "from", "a", "streams", "of", "YAMLs" ]
fc6a603367c2135b43ef2356959963d9dccbb25a
https://github.com/cogniteev/yamlious/blob/fc6a603367c2135b43ef2356959963d9dccbb25a/yamlious/__init__.py#L182-L188
249,361
etcher-be/elib_config
elib_config/_validate.py
validate_config
def validate_config(raise_=True): """ Verifies that all configuration values have a valid setting """ ELIBConfig.check() known_paths = set() duplicate_values = set() missing_values = set() for config_value in ConfigValue.config_values: if config_value.path not in known_paths: ...
python
def validate_config(raise_=True): """ Verifies that all configuration values have a valid setting """ ELIBConfig.check() known_paths = set() duplicate_values = set() missing_values = set() for config_value in ConfigValue.config_values: if config_value.path not in known_paths: ...
[ "def", "validate_config", "(", "raise_", "=", "True", ")", ":", "ELIBConfig", ".", "check", "(", ")", "known_paths", "=", "set", "(", ")", "duplicate_values", "=", "set", "(", ")", "missing_values", "=", "set", "(", ")", "for", "config_value", "in", "Con...
Verifies that all configuration values have a valid setting
[ "Verifies", "that", "all", "configuration", "values", "have", "a", "valid", "setting" ]
5d8c839e84d70126620ab0186dc1f717e5868bd0
https://github.com/etcher-be/elib_config/blob/5d8c839e84d70126620ab0186dc1f717e5868bd0/elib_config/_validate.py#L13-L35
249,362
alexandershov/mess
mess/dicts.py
groupby
def groupby(iterable, key=None): """ Group items from iterable by key and return a dictionary where values are the lists of items from the iterable having the same key. :param key: function to apply to each element of the iterable. If not specified or is None key defaults to identity function and...
python
def groupby(iterable, key=None): """ Group items from iterable by key and return a dictionary where values are the lists of items from the iterable having the same key. :param key: function to apply to each element of the iterable. If not specified or is None key defaults to identity function and...
[ "def", "groupby", "(", "iterable", ",", "key", "=", "None", ")", ":", "groups", "=", "{", "}", "for", "item", "in", "iterable", ":", "if", "key", "is", "None", ":", "key_value", "=", "item", "else", ":", "key_value", "=", "key", "(", "item", ")", ...
Group items from iterable by key and return a dictionary where values are the lists of items from the iterable having the same key. :param key: function to apply to each element of the iterable. If not specified or is None key defaults to identity function and returns the element unchanged. :E...
[ "Group", "items", "from", "iterable", "by", "key", "and", "return", "a", "dictionary", "where", "values", "are", "the", "lists", "of", "items", "from", "the", "iterable", "having", "the", "same", "key", "." ]
7b0d956c1fd39cca2e4adcd5dc35952ec3ed3fd5
https://github.com/alexandershov/mess/blob/7b0d956c1fd39cca2e4adcd5dc35952ec3ed3fd5/mess/dicts.py#L1-L21
249,363
corydodt/Crosscap
crosscap/tree.py
enter
def enter(clsQname): """ Delegate a rule to another class which instantiates a Klein app This also memoizes the resource instance on the handler function itself """ def wrapper(routeHandler): @functools.wraps(routeHandler) def inner(self, request, *a, **kw): if getattr(i...
python
def enter(clsQname): """ Delegate a rule to another class which instantiates a Klein app This also memoizes the resource instance on the handler function itself """ def wrapper(routeHandler): @functools.wraps(routeHandler) def inner(self, request, *a, **kw): if getattr(i...
[ "def", "enter", "(", "clsQname", ")", ":", "def", "wrapper", "(", "routeHandler", ")", ":", "@", "functools", ".", "wraps", "(", "routeHandler", ")", "def", "inner", "(", "self", ",", "request", ",", "*", "a", ",", "*", "*", "kw", ")", ":", "if", ...
Delegate a rule to another class which instantiates a Klein app This also memoizes the resource instance on the handler function itself
[ "Delegate", "a", "rule", "to", "another", "class", "which", "instantiates", "a", "Klein", "app" ]
388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e
https://github.com/corydodt/Crosscap/blob/388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e/crosscap/tree.py#L35-L50
249,364
corydodt/Crosscap
crosscap/tree.py
openAPIDoc
def openAPIDoc(**kwargs): """ Update a function's docstring to include the OpenAPI Yaml generated by running the openAPIGraph object """ s = yaml.dump(kwargs, default_flow_style=False) def deco(routeHandler): # Wrap routeHandler, retaining name and __doc__, then edit __doc__. # The ...
python
def openAPIDoc(**kwargs): """ Update a function's docstring to include the OpenAPI Yaml generated by running the openAPIGraph object """ s = yaml.dump(kwargs, default_flow_style=False) def deco(routeHandler): # Wrap routeHandler, retaining name and __doc__, then edit __doc__. # The ...
[ "def", "openAPIDoc", "(", "*", "*", "kwargs", ")", ":", "s", "=", "yaml", ".", "dump", "(", "kwargs", ",", "default_flow_style", "=", "False", ")", "def", "deco", "(", "routeHandler", ")", ":", "# Wrap routeHandler, retaining name and __doc__, then edit __doc__.",...
Update a function's docstring to include the OpenAPI Yaml generated by running the openAPIGraph object
[ "Update", "a", "function", "s", "docstring", "to", "include", "the", "OpenAPI", "Yaml", "generated", "by", "running", "the", "openAPIGraph", "object" ]
388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e
https://github.com/corydodt/Crosscap/blob/388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e/crosscap/tree.py#L53-L69
249,365
artisanofcode/python-broadway
broadway/errors.py
init_app
def init_app(application): """ Associates the error handler """ for code in werkzeug.exceptions.default_exceptions: application.register_error_handler(code, handle_http_exception)
python
def init_app(application): """ Associates the error handler """ for code in werkzeug.exceptions.default_exceptions: application.register_error_handler(code, handle_http_exception)
[ "def", "init_app", "(", "application", ")", ":", "for", "code", "in", "werkzeug", ".", "exceptions", ".", "default_exceptions", ":", "application", ".", "register_error_handler", "(", "code", ",", "handle_http_exception", ")" ]
Associates the error handler
[ "Associates", "the", "error", "handler" ]
a051ca5a922ecb38a541df59e8740e2a047d9a4a
https://github.com/artisanofcode/python-broadway/blob/a051ca5a922ecb38a541df59e8740e2a047d9a4a/broadway/errors.py#L40-L45
249,366
mixmastamyk/out
out/__init__.py
_find_palettes
def _find_palettes(stream): ''' Need to configure palettes manually, since we are checking stderr. ''' chosen = choose_palette(stream=stream) palettes = get_available_palettes(chosen) fg = ForegroundPalette(palettes=palettes) fx = EffectsPalette(palettes=palettes) return fg, fx, chosen
python
def _find_palettes(stream): ''' Need to configure palettes manually, since we are checking stderr. ''' chosen = choose_palette(stream=stream) palettes = get_available_palettes(chosen) fg = ForegroundPalette(palettes=palettes) fx = EffectsPalette(palettes=palettes) return fg, fx, chosen
[ "def", "_find_palettes", "(", "stream", ")", ":", "chosen", "=", "choose_palette", "(", "stream", "=", "stream", ")", "palettes", "=", "get_available_palettes", "(", "chosen", ")", "fg", "=", "ForegroundPalette", "(", "palettes", "=", "palettes", ")", "fx", ...
Need to configure palettes manually, since we are checking stderr.
[ "Need", "to", "configure", "palettes", "manually", "since", "we", "are", "checking", "stderr", "." ]
f5e02a783ed529e21753c7e6233d0c5550241fd9
https://github.com/mixmastamyk/out/blob/f5e02a783ed529e21753c7e6233d0c5550241fd9/out/__init__.py#L22-L28
249,367
mixmastamyk/out
out/__init__.py
Logger.configure
def configure(self, **kwargs): ''' Convenience function to set a number of parameters on this logger and associated handlers and formatters. ''' for kwarg in kwargs: value = kwargs[kwarg] if kwarg == 'level': self.set_level(value) ...
python
def configure(self, **kwargs): ''' Convenience function to set a number of parameters on this logger and associated handlers and formatters. ''' for kwarg in kwargs: value = kwargs[kwarg] if kwarg == 'level': self.set_level(value) ...
[ "def", "configure", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "kwarg", "in", "kwargs", ":", "value", "=", "kwargs", "[", "kwarg", "]", "if", "kwarg", "==", "'level'", ":", "self", ".", "set_level", "(", "value", ")", "elif", "kwarg", "...
Convenience function to set a number of parameters on this logger and associated handlers and formatters.
[ "Convenience", "function", "to", "set", "a", "number", "of", "parameters", "on", "this", "logger", "and", "associated", "handlers", "and", "formatters", "." ]
f5e02a783ed529e21753c7e6233d0c5550241fd9
https://github.com/mixmastamyk/out/blob/f5e02a783ed529e21753c7e6233d0c5550241fd9/out/__init__.py#L59-L115
249,368
mixmastamyk/out
out/__init__.py
Logger.log_config
def log_config(self): ''' Log the current logging configuration. ''' level = self.level debug = self.debug debug('Logging config:') debug('/ name: {}, id: {}', self.name, id(self)) debug(' .level: %s (%s)', level_map_int[level], level) debug(' .default_level: %s...
python
def log_config(self): ''' Log the current logging configuration. ''' level = self.level debug = self.debug debug('Logging config:') debug('/ name: {}, id: {}', self.name, id(self)) debug(' .level: %s (%s)', level_map_int[level], level) debug(' .default_level: %s...
[ "def", "log_config", "(", "self", ")", ":", "level", "=", "self", ".", "level", "debug", "=", "self", ".", "debug", "debug", "(", "'Logging config:'", ")", "debug", "(", "'/ name: {}, id: {}'", ",", "self", ".", "name", ",", "id", "(", "self", ")", ")"...
Log the current logging configuration.
[ "Log", "the", "current", "logging", "configuration", "." ]
f5e02a783ed529e21753c7e6233d0c5550241fd9
https://github.com/mixmastamyk/out/blob/f5e02a783ed529e21753c7e6233d0c5550241fd9/out/__init__.py#L117-L139
249,369
adminMesfix/validations
validations/dsl.py
is_valid_timestamp
def is_valid_timestamp(date, unit='millis'): """ Checks that a number that represents a date as milliseconds is correct. """ assert isinstance(date, int), "Input is not instance of int" if unit is 'millis': return is_positive(date) and len(str(date)) == 13 elif unit is 'seconds': ...
python
def is_valid_timestamp(date, unit='millis'): """ Checks that a number that represents a date as milliseconds is correct. """ assert isinstance(date, int), "Input is not instance of int" if unit is 'millis': return is_positive(date) and len(str(date)) == 13 elif unit is 'seconds': ...
[ "def", "is_valid_timestamp", "(", "date", ",", "unit", "=", "'millis'", ")", ":", "assert", "isinstance", "(", "date", ",", "int", ")", ",", "\"Input is not instance of int\"", "if", "unit", "is", "'millis'", ":", "return", "is_positive", "(", "date", ")", "...
Checks that a number that represents a date as milliseconds is correct.
[ "Checks", "that", "a", "number", "that", "represents", "a", "date", "as", "milliseconds", "is", "correct", "." ]
a2fe04514c7aa1894b20eddbb1e848678ca08861
https://github.com/adminMesfix/validations/blob/a2fe04514c7aa1894b20eddbb1e848678ca08861/validations/dsl.py#L66-L77
249,370
chartbeat-labs/swailing
swailing/logger.py
Logger.debug
def debug(self, msg=None, *args, **kwargs): """Write log at DEBUG level. Same arguments as Python's built-in Logger. """ return self._log(logging.DEBUG, msg, args, kwargs)
python
def debug(self, msg=None, *args, **kwargs): """Write log at DEBUG level. Same arguments as Python's built-in Logger. """ return self._log(logging.DEBUG, msg, args, kwargs)
[ "def", "debug", "(", "self", ",", "msg", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_log", "(", "logging", ".", "DEBUG", ",", "msg", ",", "args", ",", "kwargs", ")" ]
Write log at DEBUG level. Same arguments as Python's built-in Logger.
[ "Write", "log", "at", "DEBUG", "level", ".", "Same", "arguments", "as", "Python", "s", "built", "-", "in", "Logger", "." ]
d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222
https://github.com/chartbeat-labs/swailing/blob/d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222/swailing/logger.py#L67-L73
249,371
chartbeat-labs/swailing
swailing/logger.py
Logger.info
def info(self, msg=None, *args, **kwargs): """Similar to DEBUG but at INFO level.""" return self._log(logging.INFO, msg, args, kwargs)
python
def info(self, msg=None, *args, **kwargs): """Similar to DEBUG but at INFO level.""" return self._log(logging.INFO, msg, args, kwargs)
[ "def", "info", "(", "self", ",", "msg", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_log", "(", "logging", ".", "INFO", ",", "msg", ",", "args", ",", "kwargs", ")" ]
Similar to DEBUG but at INFO level.
[ "Similar", "to", "DEBUG", "but", "at", "INFO", "level", "." ]
d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222
https://github.com/chartbeat-labs/swailing/blob/d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222/swailing/logger.py#L75-L78
249,372
chartbeat-labs/swailing
swailing/logger.py
Logger.exception
def exception(self, msg=None, *args, **kwargs): """Similar to DEBUG but at ERROR level with exc_info set. https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L1472 """ kwargs['exc_info'] = 1 return self._log(logging.ERROR, msg, args, kwargs)
python
def exception(self, msg=None, *args, **kwargs): """Similar to DEBUG but at ERROR level with exc_info set. https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L1472 """ kwargs['exc_info'] = 1 return self._log(logging.ERROR, msg, args, kwargs)
[ "def", "exception", "(", "self", ",", "msg", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'exc_info'", "]", "=", "1", "return", "self", ".", "_log", "(", "logging", ".", "ERROR", ",", "msg", ",", "args", ",", ...
Similar to DEBUG but at ERROR level with exc_info set. https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L1472
[ "Similar", "to", "DEBUG", "but", "at", "ERROR", "level", "with", "exc_info", "set", "." ]
d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222
https://github.com/chartbeat-labs/swailing/blob/d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222/swailing/logger.py#L90-L96
249,373
chartbeat-labs/swailing
swailing/logger.py
Logger.log
def log(self, level, msg=None, *args, **kwargs): """Writes log out at any arbitray level.""" return self._log(level, msg, args, kwargs)
python
def log(self, level, msg=None, *args, **kwargs): """Writes log out at any arbitray level.""" return self._log(level, msg, args, kwargs)
[ "def", "log", "(", "self", ",", "level", ",", "msg", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_log", "(", "level", ",", "msg", ",", "args", ",", "kwargs", ")" ]
Writes log out at any arbitray level.
[ "Writes", "log", "out", "at", "any", "arbitray", "level", "." ]
d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222
https://github.com/chartbeat-labs/swailing/blob/d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222/swailing/logger.py#L103-L106
249,374
chartbeat-labs/swailing
swailing/logger.py
Logger._log
def _log(self, level, msg, args, kwargs): """Throttled log output.""" with self._tb_lock: if self._tb is None: throttled = 0 should_log = True else: throttled = self._tb.throttle_count should_log = self._tb.check_an...
python
def _log(self, level, msg, args, kwargs): """Throttled log output.""" with self._tb_lock: if self._tb is None: throttled = 0 should_log = True else: throttled = self._tb.throttle_count should_log = self._tb.check_an...
[ "def", "_log", "(", "self", ",", "level", ",", "msg", ",", "args", ",", "kwargs", ")", ":", "with", "self", ".", "_tb_lock", ":", "if", "self", ".", "_tb", "is", "None", ":", "throttled", "=", "0", "should_log", "=", "True", "else", ":", "throttled...
Throttled log output.
[ "Throttled", "log", "output", "." ]
d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222
https://github.com/chartbeat-labs/swailing/blob/d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222/swailing/logger.py#L112-L142
249,375
shaypal5/utilitime
utilitime/timestamp/timestamp.py
timestamp_to_local_time
def timestamp_to_local_time(timestamp, timezone_name): """Convert epoch timestamp to a localized Delorean datetime object. Arguments --------- timestamp : int The timestamp to convert. timezone_name : datetime.timezone The timezone of the desired local time. Returns -------...
python
def timestamp_to_local_time(timestamp, timezone_name): """Convert epoch timestamp to a localized Delorean datetime object. Arguments --------- timestamp : int The timestamp to convert. timezone_name : datetime.timezone The timezone of the desired local time. Returns -------...
[ "def", "timestamp_to_local_time", "(", "timestamp", ",", "timezone_name", ")", ":", "# first convert timestamp to UTC", "utc_time", "=", "datetime", ".", "utcfromtimestamp", "(", "float", "(", "timestamp", ")", ")", "delo", "=", "Delorean", "(", "utc_time", ",", "...
Convert epoch timestamp to a localized Delorean datetime object. Arguments --------- timestamp : int The timestamp to convert. timezone_name : datetime.timezone The timezone of the desired local time. Returns ------- delorean.Delorean A localized Delorean datetime o...
[ "Convert", "epoch", "timestamp", "to", "a", "localized", "Delorean", "datetime", "object", "." ]
554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609
https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/timestamp/timestamp.py#L12-L32
249,376
shaypal5/utilitime
utilitime/timestamp/timestamp.py
timestamp_to_local_time_str
def timestamp_to_local_time_str( timestamp, timezone_name, fmt="yyyy-MM-dd HH:mm:ss"): """Convert epoch timestamp to a localized datetime string. Arguments --------- timestamp : int The timestamp to convert. timezone_name : datetime.timezone The timezone of the desired local...
python
def timestamp_to_local_time_str( timestamp, timezone_name, fmt="yyyy-MM-dd HH:mm:ss"): """Convert epoch timestamp to a localized datetime string. Arguments --------- timestamp : int The timestamp to convert. timezone_name : datetime.timezone The timezone of the desired local...
[ "def", "timestamp_to_local_time_str", "(", "timestamp", ",", "timezone_name", ",", "fmt", "=", "\"yyyy-MM-dd HH:mm:ss\"", ")", ":", "localized_d", "=", "timestamp_to_local_time", "(", "timestamp", ",", "timezone_name", ")", "localized_datetime_str", "=", "localized_d", ...
Convert epoch timestamp to a localized datetime string. Arguments --------- timestamp : int The timestamp to convert. timezone_name : datetime.timezone The timezone of the desired local time. fmt : str The format of the output string. Returns ------- str ...
[ "Convert", "epoch", "timestamp", "to", "a", "localized", "datetime", "string", "." ]
554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609
https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/timestamp/timestamp.py#L35-L55
249,377
shaypal5/utilitime
utilitime/timestamp/timestamp.py
get_timestamp
def get_timestamp(timezone_name, year, month, day, hour=0, minute=0): """Epoch timestamp from timezone, year, month, day, hour and minute.""" tz = pytz.timezone(timezone_name) tz_datetime = tz.localize(datetime(year, month, day, hour, minute)) timestamp = calendar.timegm(tz_datetime.utctimetuple()) ...
python
def get_timestamp(timezone_name, year, month, day, hour=0, minute=0): """Epoch timestamp from timezone, year, month, day, hour and minute.""" tz = pytz.timezone(timezone_name) tz_datetime = tz.localize(datetime(year, month, day, hour, minute)) timestamp = calendar.timegm(tz_datetime.utctimetuple()) ...
[ "def", "get_timestamp", "(", "timezone_name", ",", "year", ",", "month", ",", "day", ",", "hour", "=", "0", ",", "minute", "=", "0", ")", ":", "tz", "=", "pytz", ".", "timezone", "(", "timezone_name", ")", "tz_datetime", "=", "tz", ".", "localize", "...
Epoch timestamp from timezone, year, month, day, hour and minute.
[ "Epoch", "timestamp", "from", "timezone", "year", "month", "day", "hour", "and", "minute", "." ]
554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609
https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/timestamp/timestamp.py#L58-L63
249,378
nir0s/serv
serv/init/systemd.py
SystemD.generate
def generate(self, overwrite=False): """Generate service files and returns a list of them. Note that env var names will be capitalized using a Jinja filter. This is template dependent. Even though a param might be named `key` and have value `value`, it will be rendered as `KEY=v...
python
def generate(self, overwrite=False): """Generate service files and returns a list of them. Note that env var names will be capitalized using a Jinja filter. This is template dependent. Even though a param might be named `key` and have value `value`, it will be rendered as `KEY=v...
[ "def", "generate", "(", "self", ",", "overwrite", "=", "False", ")", ":", "super", "(", "SystemD", ",", "self", ")", ".", "generate", "(", "overwrite", "=", "overwrite", ")", "self", ".", "_validate_init_system_specific_params", "(", ")", "svc_file_template", ...
Generate service files and returns a list of them. Note that env var names will be capitalized using a Jinja filter. This is template dependent. Even though a param might be named `key` and have value `value`, it will be rendered as `KEY=value`. We retrieve the names of the tem...
[ "Generate", "service", "files", "and", "returns", "a", "list", "of", "them", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/init/systemd.py#L35-L70
249,379
nir0s/serv
serv/init/systemd.py
SystemD.install
def install(self): """Install the service on the local machine This is where we deploy the service files to their relevant locations and perform any other required actions to configure the service and make it ready to be `start`ed. """ super(SystemD, self).install() ...
python
def install(self): """Install the service on the local machine This is where we deploy the service files to their relevant locations and perform any other required actions to configure the service and make it ready to be `start`ed. """ super(SystemD, self).install() ...
[ "def", "install", "(", "self", ")", ":", "super", "(", "SystemD", ",", "self", ")", ".", "install", "(", ")", "self", ".", "deploy_service_file", "(", "self", ".", "svc_file_path", ",", "self", ".", "svc_file_dest", ")", "self", ".", "deploy_service_file",...
Install the service on the local machine This is where we deploy the service files to their relevant locations and perform any other required actions to configure the service and make it ready to be `start`ed.
[ "Install", "the", "service", "on", "the", "local", "machine" ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/init/systemd.py#L72-L84
249,380
nir0s/serv
serv/init/systemd.py
SystemD.stop
def stop(self): """Stop the service. """ try: sh.systemctl.stop(self.name) except sh.ErrorReturnCode_5: self.logger.debug('Service not running.')
python
def stop(self): """Stop the service. """ try: sh.systemctl.stop(self.name) except sh.ErrorReturnCode_5: self.logger.debug('Service not running.')
[ "def", "stop", "(", "self", ")", ":", "try", ":", "sh", ".", "systemctl", ".", "stop", "(", "self", ".", "name", ")", "except", "sh", ".", "ErrorReturnCode_5", ":", "self", ".", "logger", ".", "debug", "(", "'Service not running.'", ")" ]
Stop the service.
[ "Stop", "the", "service", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/init/systemd.py#L91-L97
249,381
nir0s/serv
serv/init/systemd.py
SystemD.uninstall
def uninstall(self): """Uninstall the service. This is supposed to perform any cleanup operations required to remove the service. Files, links, whatever else should be removed. This method should also run when implementing cleanup in case of failures. As such, idempotence should...
python
def uninstall(self): """Uninstall the service. This is supposed to perform any cleanup operations required to remove the service. Files, links, whatever else should be removed. This method should also run when implementing cleanup in case of failures. As such, idempotence should...
[ "def", "uninstall", "(", "self", ")", ":", "sh", ".", "systemctl", ".", "disable", "(", "self", ".", "name", ")", "sh", ".", "systemctl", "(", "'daemon-reload'", ")", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "svc_file_dest", ")", ":"...
Uninstall the service. This is supposed to perform any cleanup operations required to remove the service. Files, links, whatever else should be removed. This method should also run when implementing cleanup in case of failures. As such, idempotence should be considered.
[ "Uninstall", "the", "service", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/init/systemd.py#L101-L114
249,382
nir0s/serv
serv/init/systemd.py
SystemD.status
def status(self, name=''): """Return a list of the statuses of the `name` service, or if name is omitted, a list of the status of all services for this specific init system. There should be a standardization around the status fields. There currently isn't. `self.service...
python
def status(self, name=''): """Return a list of the statuses of the `name` service, or if name is omitted, a list of the status of all services for this specific init system. There should be a standardization around the status fields. There currently isn't. `self.service...
[ "def", "status", "(", "self", ",", "name", "=", "''", ")", ":", "super", "(", "SystemD", ",", "self", ")", ".", "status", "(", "name", "=", "name", ")", "svc_list", "=", "sh", ".", "systemctl", "(", "'--no-legend'", ",", "'--no-pager'", ",", "t", "...
Return a list of the statuses of the `name` service, or if name is omitted, a list of the status of all services for this specific init system. There should be a standardization around the status fields. There currently isn't. `self.services` is set in `base.py`
[ "Return", "a", "list", "of", "the", "statuses", "of", "the", "name", "service", "or", "if", "name", "is", "omitted", "a", "list", "of", "the", "status", "of", "all", "services", "for", "this", "specific", "init", "system", "." ]
7af724ed49c0eb766c37c4b5287b043a8cf99e9c
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/init/systemd.py#L116-L135
249,383
totokaka/pySpaceGDN
pyspacegdn/requests/find_request.py
FindRequest.sort
def sort(self, *sort): """ Sort the results. Define how the results should be sorted. The arguments should be tuples of string defining the key and direction to sort by. For example `('name', 'asc')` and `('version', 'desc')`. The first sorte rule is considered first by the API....
python
def sort(self, *sort): """ Sort the results. Define how the results should be sorted. The arguments should be tuples of string defining the key and direction to sort by. For example `('name', 'asc')` and `('version', 'desc')`. The first sorte rule is considered first by the API....
[ "def", "sort", "(", "self", ",", "*", "sort", ")", ":", "self", ".", "add_get_param", "(", "'sort'", ",", "FILTER_DELIMITER", ".", "join", "(", "[", "ELEMENT_DELIMITER", ".", "join", "(", "elements", ")", "for", "elements", "in", "sort", "]", ")", ")",...
Sort the results. Define how the results should be sorted. The arguments should be tuples of string defining the key and direction to sort by. For example `('name', 'asc')` and `('version', 'desc')`. The first sorte rule is considered first by the API. See also the API documentation on ...
[ "Sort", "the", "results", "." ]
55c8be8d751e24873e0a7f7e99d2b715442ec878
https://github.com/totokaka/pySpaceGDN/blob/55c8be8d751e24873e0a7f7e99d2b715442ec878/pyspacegdn/requests/find_request.py#L73-L91
249,384
totokaka/pySpaceGDN
pyspacegdn/requests/find_request.py
FindRequest.where
def where(self, *where): """ Filter the results. Filter the results by provided rules. The rules should be tuples that look like this:: ('<key>', '<operator>', '<value>') For example:: ('name', '$eq', 'Vanilla Minecraft') This is also covered in the d...
python
def where(self, *where): """ Filter the results. Filter the results by provided rules. The rules should be tuples that look like this:: ('<key>', '<operator>', '<value>') For example:: ('name', '$eq', 'Vanilla Minecraft') This is also covered in the d...
[ "def", "where", "(", "self", ",", "*", "where", ")", ":", "filters", "=", "list", "(", ")", "for", "key", ",", "operator", ",", "value", "in", "where", ":", "filters", ".", "append", "(", "ELEMENT_DELIMITER", ".", "join", "(", "(", "key", ",", "ope...
Filter the results. Filter the results by provided rules. The rules should be tuples that look like this:: ('<key>', '<operator>', '<value>') For example:: ('name', '$eq', 'Vanilla Minecraft') This is also covered in the documentation_ of the SpaceGDN API. ...
[ "Filter", "the", "results", "." ]
55c8be8d751e24873e0a7f7e99d2b715442ec878
https://github.com/totokaka/pySpaceGDN/blob/55c8be8d751e24873e0a7f7e99d2b715442ec878/pyspacegdn/requests/find_request.py#L93-L114
249,385
totokaka/pySpaceGDN
pyspacegdn/requests/find_request.py
FindRequest.fetch
def fetch(self): """ Run the request and fetch the results. This method will compile the request, send it to the SpaceGDN endpoint defined with the `SpaceGDN` object and wrap the results in a :class:`pyspacegdn.Response` object. Returns a :class:`pyspacegdn.Response` object. ...
python
def fetch(self): """ Run the request and fetch the results. This method will compile the request, send it to the SpaceGDN endpoint defined with the `SpaceGDN` object and wrap the results in a :class:`pyspacegdn.Response` object. Returns a :class:`pyspacegdn.Response` object. ...
[ "def", "fetch", "(", "self", ")", ":", "response", "=", "Response", "(", ")", "has_next", "=", "True", "while", "has_next", ":", "resp", "=", "self", ".", "_fetch", "(", "default_path", "=", "'v2'", ")", "results", "=", "None", "if", "resp", ".", "su...
Run the request and fetch the results. This method will compile the request, send it to the SpaceGDN endpoint defined with the `SpaceGDN` object and wrap the results in a :class:`pyspacegdn.Response` object. Returns a :class:`pyspacegdn.Response` object.
[ "Run", "the", "request", "and", "fetch", "the", "results", "." ]
55c8be8d751e24873e0a7f7e99d2b715442ec878
https://github.com/totokaka/pySpaceGDN/blob/55c8be8d751e24873e0a7f7e99d2b715442ec878/pyspacegdn/requests/find_request.py#L116-L137
249,386
kalekundert/nonstdlib
nonstdlib/meta.py
singleton
def singleton(cls): """ Decorator function that turns a class into a singleton. """ import inspect # Create a structure to store instances of any singletons that get # created. instances = {} # Make sure that the constructor for this class doesn't take any # arguments. Since singletons ca...
python
def singleton(cls): """ Decorator function that turns a class into a singleton. """ import inspect # Create a structure to store instances of any singletons that get # created. instances = {} # Make sure that the constructor for this class doesn't take any # arguments. Since singletons ca...
[ "def", "singleton", "(", "cls", ")", ":", "import", "inspect", "# Create a structure to store instances of any singletons that get", "# created.", "instances", "=", "{", "}", "# Make sure that the constructor for this class doesn't take any", "# arguments. Since singletons can only be...
Decorator function that turns a class into a singleton.
[ "Decorator", "function", "that", "turns", "a", "class", "into", "a", "singleton", "." ]
3abf4a4680056d6d97f2a5988972eb9392756fb6
https://github.com/kalekundert/nonstdlib/blob/3abf4a4680056d6d97f2a5988972eb9392756fb6/nonstdlib/meta.py#L40-L75
249,387
heikomuller/sco-engine
scoengine/model.py
ModelOutputFile.from_dict
def from_dict(doc): """Create a model output file object from a dictionary. """ if 'path' in doc: path = doc['path'] else: path = None return ModelOutputFile( doc['filename'], doc['mimeType'], path=path )
python
def from_dict(doc): """Create a model output file object from a dictionary. """ if 'path' in doc: path = doc['path'] else: path = None return ModelOutputFile( doc['filename'], doc['mimeType'], path=path )
[ "def", "from_dict", "(", "doc", ")", ":", "if", "'path'", "in", "doc", ":", "path", "=", "doc", "[", "'path'", "]", "else", ":", "path", "=", "None", "return", "ModelOutputFile", "(", "doc", "[", "'filename'", "]", ",", "doc", "[", "'mimeType'", "]",...
Create a model output file object from a dictionary.
[ "Create", "a", "model", "output", "file", "object", "from", "a", "dictionary", "." ]
3e7782d059ec808d930f0992794b6f5a8fd73c2c
https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/model.py#L61-L73
249,388
heikomuller/sco-engine
scoengine/model.py
ModelOutputs.from_dict
def from_dict(doc): """Create a model output object from a dictionary. """ return ModelOutputs( ModelOutputFile.from_dict(doc['prediction']), [ModelOutputFile.from_dict(a) for a in doc['attachments']] )
python
def from_dict(doc): """Create a model output object from a dictionary. """ return ModelOutputs( ModelOutputFile.from_dict(doc['prediction']), [ModelOutputFile.from_dict(a) for a in doc['attachments']] )
[ "def", "from_dict", "(", "doc", ")", ":", "return", "ModelOutputs", "(", "ModelOutputFile", ".", "from_dict", "(", "doc", "[", "'prediction'", "]", ")", ",", "[", "ModelOutputFile", ".", "from_dict", "(", "a", ")", "for", "a", "in", "doc", "[", "'attachm...
Create a model output object from a dictionary.
[ "Create", "a", "model", "output", "object", "from", "a", "dictionary", "." ]
3e7782d059ec808d930f0992794b6f5a8fd73c2c
https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/model.py#L131-L138
249,389
heikomuller/sco-engine
scoengine/model.py
ModelRegistry.to_dict
def to_dict(self, model): """Create a dictionary serialization for a model. Parameters ---------- model : ModelHandle Returns ------- dict Dictionary serialization for a model """ # Get the basic Json object from the super class ...
python
def to_dict(self, model): """Create a dictionary serialization for a model. Parameters ---------- model : ModelHandle Returns ------- dict Dictionary serialization for a model """ # Get the basic Json object from the super class ...
[ "def", "to_dict", "(", "self", ",", "model", ")", ":", "# Get the basic Json object from the super class", "obj", "=", "super", "(", "ModelRegistry", ",", "self", ")", ".", "to_dict", "(", "model", ")", "# Add model parameter", "obj", "[", "'parameters'", "]", "...
Create a dictionary serialization for a model. Parameters ---------- model : ModelHandle Returns ------- dict Dictionary serialization for a model
[ "Create", "a", "dictionary", "serialization", "for", "a", "model", "." ]
3e7782d059ec808d930f0992794b6f5a8fd73c2c
https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/model.py#L369-L389
249,390
bmweiner/skillful
skillful/interface.py
_snake_to_camel
def _snake_to_camel(name, strict=False): """Converts parameter names from snake_case to camelCase. Args: name, str. Snake case. strict: bool, default True. If True, will set name to lowercase before converting, otherwise assumes original name is proper camel case. Set to...
python
def _snake_to_camel(name, strict=False): """Converts parameter names from snake_case to camelCase. Args: name, str. Snake case. strict: bool, default True. If True, will set name to lowercase before converting, otherwise assumes original name is proper camel case. Set to...
[ "def", "_snake_to_camel", "(", "name", ",", "strict", "=", "False", ")", ":", "if", "strict", ":", "name", "=", "name", ".", "lower", "(", ")", "terms", "=", "name", ".", "split", "(", "'_'", ")", "return", "terms", "[", "0", "]", "+", "''", ".",...
Converts parameter names from snake_case to camelCase. Args: name, str. Snake case. strict: bool, default True. If True, will set name to lowercase before converting, otherwise assumes original name is proper camel case. Set to False if name may already be in camelCase. ...
[ "Converts", "parameter", "names", "from", "snake_case", "to", "camelCase", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L565-L580
249,391
bmweiner/skillful
skillful/interface.py
DefaultAttrMixin._set_default_attr
def _set_default_attr(self, default_attr): """Sets default attributes when None. Args: default_attr: dict. Key-val of attr, default-value. """ for attr, val in six.iteritems(default_attr): if getattr(self, attr, None) is None: setattr(self, attr, ...
python
def _set_default_attr(self, default_attr): """Sets default attributes when None. Args: default_attr: dict. Key-val of attr, default-value. """ for attr, val in six.iteritems(default_attr): if getattr(self, attr, None) is None: setattr(self, attr, ...
[ "def", "_set_default_attr", "(", "self", ",", "default_attr", ")", ":", "for", "attr", ",", "val", "in", "six", ".", "iteritems", "(", "default_attr", ")", ":", "if", "getattr", "(", "self", ",", "attr", ",", "None", ")", "is", "None", ":", "setattr", ...
Sets default attributes when None. Args: default_attr: dict. Key-val of attr, default-value.
[ "Sets", "default", "attributes", "when", "None", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L10-L18
249,392
bmweiner/skillful
skillful/interface.py
Body.to_json
def to_json(self, drop_null=True, camel=False, indent=None, sort_keys=False): """Serialize self as JSON Args: drop_null: bool, default True. Remove 'empty' attributes. See to_dict. camel: bool, default True. Convert keys to camelCase. indent: int, def...
python
def to_json(self, drop_null=True, camel=False, indent=None, sort_keys=False): """Serialize self as JSON Args: drop_null: bool, default True. Remove 'empty' attributes. See to_dict. camel: bool, default True. Convert keys to camelCase. indent: int, def...
[ "def", "to_json", "(", "self", ",", "drop_null", "=", "True", ",", "camel", "=", "False", ",", "indent", "=", "None", ",", "sort_keys", "=", "False", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "to_dict", "(", "drop_null", ",", "camel...
Serialize self as JSON Args: drop_null: bool, default True. Remove 'empty' attributes. See to_dict. camel: bool, default True. Convert keys to camelCase. indent: int, default None. See json built-in. sort_keys: bool, default False. See json built-...
[ "Serialize", "self", "as", "JSON" ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L29-L43
249,393
bmweiner/skillful
skillful/interface.py
Body.to_dict
def to_dict(self, drop_null=True, camel=False): """Serialize self as dict. Args: drop_null: bool, default True. Remove 'empty' attributes. camel: bool, default True. Convert keys to camelCase. Return: dict: object params. """ #return _to_dict...
python
def to_dict(self, drop_null=True, camel=False): """Serialize self as dict. Args: drop_null: bool, default True. Remove 'empty' attributes. camel: bool, default True. Convert keys to camelCase. Return: dict: object params. """ #return _to_dict...
[ "def", "to_dict", "(", "self", ",", "drop_null", "=", "True", ",", "camel", "=", "False", ")", ":", "#return _to_dict(self, drop_null, camel)", "def", "to_dict", "(", "obj", ",", "drop_null", ",", "camel", ")", ":", "\"\"\"Recursively constructs the dict.\"\"\"", ...
Serialize self as dict. Args: drop_null: bool, default True. Remove 'empty' attributes. camel: bool, default True. Convert keys to camelCase. Return: dict: object params.
[ "Serialize", "self", "as", "dict", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L45-L80
249,394
bmweiner/skillful
skillful/interface.py
RequestBody.parse
def parse(self, body): """Parse JSON request, storing content in object attributes. Args: body: str. HTTP request body. Returns: self """ if isinstance(body, six.string_types): body = json.loads(body) # version version = body...
python
def parse(self, body): """Parse JSON request, storing content in object attributes. Args: body: str. HTTP request body. Returns: self """ if isinstance(body, six.string_types): body = json.loads(body) # version version = body...
[ "def", "parse", "(", "self", ",", "body", ")", ":", "if", "isinstance", "(", "body", ",", "six", ".", "string_types", ")", ":", "body", "=", "json", ".", "loads", "(", "body", ")", "# version", "version", "=", "body", "[", "'version'", "]", "self", ...
Parse JSON request, storing content in object attributes. Args: body: str. HTTP request body. Returns: self
[ "Parse", "JSON", "request", "storing", "content", "in", "object", "attributes", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L112-L170
249,395
bmweiner/skillful
skillful/interface.py
ResponseBody.set_speech_text
def set_speech_text(self, text): """Set response output speech as plain text type. Args: text: str. Response speech used when type is 'PlainText'. Cannot exceed 8,000 characters. """ self.response.outputSpeech.type = 'PlainText' self.response.outputSp...
python
def set_speech_text(self, text): """Set response output speech as plain text type. Args: text: str. Response speech used when type is 'PlainText'. Cannot exceed 8,000 characters. """ self.response.outputSpeech.type = 'PlainText' self.response.outputSp...
[ "def", "set_speech_text", "(", "self", ",", "text", ")", ":", "self", ".", "response", ".", "outputSpeech", ".", "type", "=", "'PlainText'", "self", ".", "response", ".", "outputSpeech", ".", "text", "=", "text" ]
Set response output speech as plain text type. Args: text: str. Response speech used when type is 'PlainText'. Cannot exceed 8,000 characters.
[ "Set", "response", "output", "speech", "as", "plain", "text", "type", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L365-L373
249,396
bmweiner/skillful
skillful/interface.py
ResponseBody.set_speech_ssml
def set_speech_ssml(self, ssml): """Set response output speech as SSML type. Args: ssml: str. Response speech used when type is 'SSML', should be formatted with Speech Synthesis Markup Language. Cannot exceed 8,000 characters. """ self.respons...
python
def set_speech_ssml(self, ssml): """Set response output speech as SSML type. Args: ssml: str. Response speech used when type is 'SSML', should be formatted with Speech Synthesis Markup Language. Cannot exceed 8,000 characters. """ self.respons...
[ "def", "set_speech_ssml", "(", "self", ",", "ssml", ")", ":", "self", ".", "response", ".", "outputSpeech", ".", "type", "=", "'SSML'", "self", ".", "response", ".", "outputSpeech", ".", "ssml", "=", "ssml" ]
Set response output speech as SSML type. Args: ssml: str. Response speech used when type is 'SSML', should be formatted with Speech Synthesis Markup Language. Cannot exceed 8,000 characters.
[ "Set", "response", "output", "speech", "as", "SSML", "type", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L375-L384
249,397
bmweiner/skillful
skillful/interface.py
ResponseBody.set_card_simple
def set_card_simple(self, title, content): """Set response card as simple type. title and content cannot exceed 8,000 characters. Args: title: str. Title of Simple or Standard type card. content: str. Content of Simple type card. """ self.response.card.t...
python
def set_card_simple(self, title, content): """Set response card as simple type. title and content cannot exceed 8,000 characters. Args: title: str. Title of Simple or Standard type card. content: str. Content of Simple type card. """ self.response.card.t...
[ "def", "set_card_simple", "(", "self", ",", "title", ",", "content", ")", ":", "self", ".", "response", ".", "card", ".", "type", "=", "'Simple'", "self", ".", "response", ".", "card", ".", "title", "=", "title", "self", ".", "response", ".", "card", ...
Set response card as simple type. title and content cannot exceed 8,000 characters. Args: title: str. Title of Simple or Standard type card. content: str. Content of Simple type card.
[ "Set", "response", "card", "as", "simple", "type", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L386-L397
249,398
bmweiner/skillful
skillful/interface.py
ResponseBody.set_card_standard
def set_card_standard(self, title, text, smallImageUrl=None, largeImageUrl=None): """Set response card as standard type. title, text, and image cannot exceed 8,000 characters. Args: title: str. Title of Simple or Standard type card. text: str. ...
python
def set_card_standard(self, title, text, smallImageUrl=None, largeImageUrl=None): """Set response card as standard type. title, text, and image cannot exceed 8,000 characters. Args: title: str. Title of Simple or Standard type card. text: str. ...
[ "def", "set_card_standard", "(", "self", ",", "title", ",", "text", ",", "smallImageUrl", "=", "None", ",", "largeImageUrl", "=", "None", ")", ":", "self", ".", "response", ".", "card", ".", "type", "=", "'Standard'", "self", ".", "response", ".", "card"...
Set response card as standard type. title, text, and image cannot exceed 8,000 characters. Args: title: str. Title of Simple or Standard type card. text: str. Content of Standard type card. smallImageUrl: str. URL of small image. Cannot exceed 2,000 ...
[ "Set", "response", "card", "as", "standard", "type", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L399-L419
249,399
bmweiner/skillful
skillful/interface.py
ResponseBody.set_reprompt_text
def set_reprompt_text(self, text): """Set response reprompt output speech as plain text type. Args: text: str. Response speech used when type is 'PlainText'. Cannot exceed 8,000 characters. """ self.response.reprompt.outputSpeech.type = 'PlainText' se...
python
def set_reprompt_text(self, text): """Set response reprompt output speech as plain text type. Args: text: str. Response speech used when type is 'PlainText'. Cannot exceed 8,000 characters. """ self.response.reprompt.outputSpeech.type = 'PlainText' se...
[ "def", "set_reprompt_text", "(", "self", ",", "text", ")", ":", "self", ".", "response", ".", "reprompt", ".", "outputSpeech", ".", "type", "=", "'PlainText'", "self", ".", "response", ".", "reprompt", ".", "outputSpeech", ".", "text", "=", "text" ]
Set response reprompt output speech as plain text type. Args: text: str. Response speech used when type is 'PlainText'. Cannot exceed 8,000 characters.
[ "Set", "response", "reprompt", "output", "speech", "as", "plain", "text", "type", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/interface.py#L425-L433