repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
roboogle/gtkmvc3
gtkmvco/examples/converter/src/views/currencies.py
CurrenciesView.add_currency_view
def add_currency_view(self, select=False): """returns the newly added view""" v = CurrencyView() self.remove_currency_view() self['hbox_top'].pack_end(v.get_top_widget()) v.light_name(select) return v
python
def add_currency_view(self, select=False): """returns the newly added view""" v = CurrencyView() self.remove_currency_view() self['hbox_top'].pack_end(v.get_top_widget()) v.light_name(select) return v
[ "def", "add_currency_view", "(", "self", ",", "select", "=", "False", ")", ":", "v", "=", "CurrencyView", "(", ")", "self", ".", "remove_currency_view", "(", ")", "self", "[", "'hbox_top'", "]", ".", "pack_end", "(", "v", ".", "get_top_widget", "(", ")",...
returns the newly added view
[ "returns", "the", "newly", "added", "view" ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/converter/src/views/currencies.py#L41-L47
ROGUE-JCTD/django-tilebundler
tilebundler/helpers.py
generate_confs
def generate_confs(tileset, ignore_warnings=True, renderd=False): """ Takes a Tileset object and returns mapproxy and seed config files """ mapproxy_conf_json = """ { "services":{ "wms":{ "on_source_errors":"raise", "image_formats": ["image/png"] } }, ...
python
def generate_confs(tileset, ignore_warnings=True, renderd=False): """ Takes a Tileset object and returns mapproxy and seed config files """ mapproxy_conf_json = """ { "services":{ "wms":{ "on_source_errors":"raise", "image_formats": ["image/png"] } }, ...
[ "def", "generate_confs", "(", "tileset", ",", "ignore_warnings", "=", "True", ",", "renderd", "=", "False", ")", ":", "mapproxy_conf_json", "=", "\"\"\"\n {\n \"services\":{\n \"wms\":{\n \"on_source_errors\":\"raise\",\n \"image_formats\": [\"image/p...
Takes a Tileset object and returns mapproxy and seed config files
[ "Takes", "a", "Tileset", "object", "and", "returns", "mapproxy", "and", "seed", "config", "files" ]
train
https://github.com/ROGUE-JCTD/django-tilebundler/blob/72bc25293c9d0e3608f9dba16eb6de5df8d679ee/tilebundler/helpers.py#L21-L202
mback2k/python-appengine-auth
social_appengine_auth/pipelines.py
associate_by_user_id
def associate_by_user_id(backend, details, response, user=None, *args, **kwargs): """ Associate current auth with a user with the same Google user_id in the DB. """ if user: return None user_id = response.get('id') if user_id: # Try to associate accounts registered with the same...
python
def associate_by_user_id(backend, details, response, user=None, *args, **kwargs): """ Associate current auth with a user with the same Google user_id in the DB. """ if user: return None user_id = response.get('id') if user_id: # Try to associate accounts registered with the same...
[ "def", "associate_by_user_id", "(", "backend", ",", "details", ",", "response", ",", "user", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "user", ":", "return", "None", "user_id", "=", "response", ".", "get", "(", "'id'", "...
Associate current auth with a user with the same Google user_id in the DB.
[ "Associate", "current", "auth", "with", "a", "user", "with", "the", "same", "Google", "user_id", "in", "the", "DB", "." ]
train
https://github.com/mback2k/python-appengine-auth/blob/dd27a0c53c7bebe147f7a6e3606c67ec673ac4d6/social_appengine_auth/pipelines.py#L2-L17
roboogle/gtkmvc3
gtkmvco/examples/converter/src/controllers/amount.py
AmountCtrl.register_view
def register_view(self, view): """Creates treeview columns, and connect missing signals""" cb = self.view['cb_currency'] cb.set_model(self.model.currencies) cell = gtk.CellRendererText() cb.pack_start(cell, True) def on_cell_data(cb, cell, mod, it): i...
python
def register_view(self, view): """Creates treeview columns, and connect missing signals""" cb = self.view['cb_currency'] cb.set_model(self.model.currencies) cell = gtk.CellRendererText() cb.pack_start(cell, True) def on_cell_data(cb, cell, mod, it): i...
[ "def", "register_view", "(", "self", ",", "view", ")", ":", "cb", "=", "self", ".", "view", "[", "'cb_currency'", "]", "cb", ".", "set_model", "(", "self", ".", "model", ".", "currencies", ")", "cell", "=", "gtk", ".", "CellRendererText", "(", ")", "...
Creates treeview columns, and connect missing signals
[ "Creates", "treeview", "columns", "and", "connect", "missing", "signals" ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/converter/src/controllers/amount.py#L39-L51
twneale/hercules
hercules/decorators.py
memoize_methodcalls
def memoize_methodcalls(func, pickle=False, dumps=pickle.dumps): '''Cache the results of the function for each input it gets called with. ''' cache = func._memoize_cache = {} @functools.wraps(func) def memoizer(self, *args, **kwargs): if pickle: key = dumps((args, kwargs)) ...
python
def memoize_methodcalls(func, pickle=False, dumps=pickle.dumps): '''Cache the results of the function for each input it gets called with. ''' cache = func._memoize_cache = {} @functools.wraps(func) def memoizer(self, *args, **kwargs): if pickle: key = dumps((args, kwargs)) ...
[ "def", "memoize_methodcalls", "(", "func", ",", "pickle", "=", "False", ",", "dumps", "=", "pickle", ".", "dumps", ")", ":", "cache", "=", "func", ".", "_memoize_cache", "=", "{", "}", "@", "functools", ".", "wraps", "(", "func", ")", "def", "memoizer"...
Cache the results of the function for each input it gets called with.
[ "Cache", "the", "results", "of", "the", "function", "for", "each", "input", "it", "gets", "called", "with", "." ]
train
https://github.com/twneale/hercules/blob/cd61582ef7e593093e9b28b56798df4203d1467a/hercules/decorators.py#L40-L53
pip-services3-python/pip-services3-commons-python
pip_services3_commons/config/ConfigParams.py
ConfigParams.get_section
def get_section(self, section): """ Gets parameters from specific section stored in this ConfigMap. The section name is removed from parameter keys. :param section: name of the section to retrieve configuration parameters from. :return: all configuration parameters that belong ...
python
def get_section(self, section): """ Gets parameters from specific section stored in this ConfigMap. The section name is removed from parameter keys. :param section: name of the section to retrieve configuration parameters from. :return: all configuration parameters that belong ...
[ "def", "get_section", "(", "self", ",", "section", ")", ":", "result", "=", "ConfigParams", "(", ")", "prefix", "=", "section", "+", "\".\"", "for", "(", "key", ",", "value", ")", "in", "self", ".", "items", "(", ")", ":", "# Prevents exception on the ne...
Gets parameters from specific section stored in this ConfigMap. The section name is removed from parameter keys. :param section: name of the section to retrieve configuration parameters from. :return: all configuration parameters that belong to the section named 'section'.
[ "Gets", "parameters", "from", "specific", "section", "stored", "in", "this", "ConfigMap", ".", "The", "section", "name", "is", "removed", "from", "parameter", "keys", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/config/ConfigParams.py#L81-L104
pip-services3-python/pip-services3-commons-python
pip_services3_commons/config/ConfigParams.py
ConfigParams.add_section
def add_section(self, section, section_params): """ Adds parameters into this ConfigParams under specified section. Keys for the new parameters are appended with section dot prefix. :param section: name of the section where add new parameters :param section_params: new paramete...
python
def add_section(self, section, section_params): """ Adds parameters into this ConfigParams under specified section. Keys for the new parameters are appended with section dot prefix. :param section: name of the section where add new parameters :param section_params: new paramete...
[ "def", "add_section", "(", "self", ",", "section", ",", "section_params", ")", ":", "if", "section", "==", "None", ":", "raise", "Exception", "(", "\"Section name cannot be null\"", ")", "section", "=", "\"\"", "if", "self", ".", "_is_shadow_name", "(", "secti...
Adds parameters into this ConfigParams under specified section. Keys for the new parameters are appended with section dot prefix. :param section: name of the section where add new parameters :param section_params: new parameters to be added.
[ "Adds", "parameters", "into", "this", "ConfigParams", "under", "specified", "section", ".", "Keys", "for", "the", "new", "parameters", "are", "appended", "with", "section", "dot", "prefix", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/config/ConfigParams.py#L111-L136
pip-services3-python/pip-services3-commons-python
pip_services3_commons/config/ConfigParams.py
ConfigParams.override
def override(self, config_params): """ Overrides parameters with new values from specified ConfigParams and returns a new ConfigParams object. :param config_params: ConfigMap with parameters to override the current values. :return: a new ConfigParams object. """ map = S...
python
def override(self, config_params): """ Overrides parameters with new values from specified ConfigParams and returns a new ConfigParams object. :param config_params: ConfigMap with parameters to override the current values. :return: a new ConfigParams object. """ map = S...
[ "def", "override", "(", "self", ",", "config_params", ")", ":", "map", "=", "StringValueMap", ".", "from_maps", "(", "self", ",", "config_params", ")", "return", "ConfigParams", "(", "map", ")" ]
Overrides parameters with new values from specified ConfigParams and returns a new ConfigParams object. :param config_params: ConfigMap with parameters to override the current values. :return: a new ConfigParams object.
[ "Overrides", "parameters", "with", "new", "values", "from", "specified", "ConfigParams", "and", "returns", "a", "new", "ConfigParams", "object", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/config/ConfigParams.py#L139-L148
pip-services3-python/pip-services3-commons-python
pip_services3_commons/config/ConfigParams.py
ConfigParams.set_defaults
def set_defaults(self, default_config_params): """ Set default values from specified ConfigParams and returns a new ConfigParams object. :param default_config_params: ConfigMap with default parameter values. :return: a new ConfigParams object. """ map = StringValueMap.f...
python
def set_defaults(self, default_config_params): """ Set default values from specified ConfigParams and returns a new ConfigParams object. :param default_config_params: ConfigMap with default parameter values. :return: a new ConfigParams object. """ map = StringValueMap.f...
[ "def", "set_defaults", "(", "self", ",", "default_config_params", ")", ":", "map", "=", "StringValueMap", ".", "from_maps", "(", "default_config_params", ",", "self", ")", "return", "ConfigParams", "(", "map", ")" ]
Set default values from specified ConfigParams and returns a new ConfigParams object. :param default_config_params: ConfigMap with default parameter values. :return: a new ConfigParams object.
[ "Set", "default", "values", "from", "specified", "ConfigParams", "and", "returns", "a", "new", "ConfigParams", "object", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/config/ConfigParams.py#L151-L160
steenzout/python-serialization-json
steenzout/serialization/json/__init__.py
serialize
def serialize(obj): """Serialize the given object into JSON. Args: obj: the object to be serialized. Returns: (str): JSON representation of the given object. """ LOGGER.debug('serialize(%s)', obj) if isinstance(obj, datetime.date): return simplejson.dumps(obj, default=...
python
def serialize(obj): """Serialize the given object into JSON. Args: obj: the object to be serialized. Returns: (str): JSON representation of the given object. """ LOGGER.debug('serialize(%s)', obj) if isinstance(obj, datetime.date): return simplejson.dumps(obj, default=...
[ "def", "serialize", "(", "obj", ")", ":", "LOGGER", ".", "debug", "(", "'serialize(%s)'", ",", "obj", ")", "if", "isinstance", "(", "obj", ",", "datetime", ".", "date", ")", ":", "return", "simplejson", ".", "dumps", "(", "obj", ",", "default", "=", ...
Serialize the given object into JSON. Args: obj: the object to be serialized. Returns: (str): JSON representation of the given object.
[ "Serialize", "the", "given", "object", "into", "JSON", "." ]
train
https://github.com/steenzout/python-serialization-json/blob/583568e14cc02ba0bf711f56b8a0a3ad142c696d/steenzout/serialization/json/__init__.py#L30-L47
steenzout/python-serialization-json
steenzout/serialization/json/__init__.py
deserialize
def deserialize(json, cls=None): """Deserialize a JSON string into a Python object. Args: json (str): the JSON string. cls (:py:class:`object`): if the ``json`` is deserialized into a ``dict`` and this argument is set, the ``dict`` keys are passed as keyword ...
python
def deserialize(json, cls=None): """Deserialize a JSON string into a Python object. Args: json (str): the JSON string. cls (:py:class:`object`): if the ``json`` is deserialized into a ``dict`` and this argument is set, the ``dict`` keys are passed as keyword ...
[ "def", "deserialize", "(", "json", ",", "cls", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "'deserialize(%s)'", ",", "json", ")", "out", "=", "simplejson", ".", "loads", "(", "json", ")", "if", "isinstance", "(", "out", ",", "dict", ")", "and...
Deserialize a JSON string into a Python object. Args: json (str): the JSON string. cls (:py:class:`object`): if the ``json`` is deserialized into a ``dict`` and this argument is set, the ``dict`` keys are passed as keyword arguments to the given ``cls...
[ "Deserialize", "a", "JSON", "string", "into", "a", "Python", "object", "." ]
train
https://github.com/steenzout/python-serialization-json/blob/583568e14cc02ba0bf711f56b8a0a3ad142c696d/steenzout/serialization/json/__init__.py#L50-L71
zmiller91/aws-lambda-api-builder
api_builder/cloudformation.py
main
def main(stack_name, template, mustache_variables): 'Update or create stack' template_data = _parse_template(template, mustache_variables) params = { 'StackName': stack_name, 'TemplateBody': template_data } try: if _stack_exists(stack_name): print('Updating {}'....
python
def main(stack_name, template, mustache_variables): 'Update or create stack' template_data = _parse_template(template, mustache_variables) params = { 'StackName': stack_name, 'TemplateBody': template_data } try: if _stack_exists(stack_name): print('Updating {}'....
[ "def", "main", "(", "stack_name", ",", "template", ",", "mustache_variables", ")", ":", "template_data", "=", "_parse_template", "(", "template", ",", "mustache_variables", ")", "params", "=", "{", "'StackName'", ":", "stack_name", ",", "'TemplateBody'", ":", "t...
Update or create stack
[ "Update", "or", "create", "stack" ]
train
https://github.com/zmiller91/aws-lambda-api-builder/blob/86026b5c134faa33eaa1e1268e0206cb074e3285/api_builder/cloudformation.py#L10-L60
zmiller91/aws-lambda-api-builder
api_builder/cloudformation.py
json_serial
def json_serial(obj): """JSON serializer for objects not serializable by default json code""" if isinstance(obj, datetime): serial = obj.isoformat() return serial raise TypeError("Type not serializable")
python
def json_serial(obj): """JSON serializer for objects not serializable by default json code""" if isinstance(obj, datetime): serial = obj.isoformat() return serial raise TypeError("Type not serializable")
[ "def", "json_serial", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "datetime", ")", ":", "serial", "=", "obj", ".", "isoformat", "(", ")", "return", "serial", "raise", "TypeError", "(", "\"Type not serializable\"", ")" ]
JSON serializer for objects not serializable by default json code
[ "JSON", "serializer", "for", "objects", "not", "serializable", "by", "default", "json", "code" ]
train
https://github.com/zmiller91/aws-lambda-api-builder/blob/86026b5c134faa33eaa1e1268e0206cb074e3285/api_builder/cloudformation.py#L90-L95
rvswift/EB
EB/builder/splitter/splitter_io.py
print_extended_help
def print_extended_help(): """ Prints an extended help message. """ # initiate TextWrapper class, which will handle all of the string formatting w = textwrap.TextWrapper() w.expand_tabs = False w.width=110 w.initial_indent = ' ' w.subsequent_indent = ' ' print('') print(te...
python
def print_extended_help(): """ Prints an extended help message. """ # initiate TextWrapper class, which will handle all of the string formatting w = textwrap.TextWrapper() w.expand_tabs = False w.width=110 w.initial_indent = ' ' w.subsequent_indent = ' ' print('') print(te...
[ "def", "print_extended_help", "(", ")", ":", "# initiate TextWrapper class, which will handle all of the string formatting", "w", "=", "textwrap", ".", "TextWrapper", "(", ")", "w", ".", "expand_tabs", "=", "False", "w", ".", "width", "=", "110", "w", ".", "initial_...
Prints an extended help message.
[ "Prints", "an", "extended", "help", "message", "." ]
train
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter_io.py#L26-L70
rvswift/EB
EB/builder/splitter/splitter_io.py
ParseArgs.get_float
def get_float(self, input_string): """ Return float type user input """ if input_string == '--training_fraction': # was the flag set? try: index = self.args.index(input_string) + 1 except ValueError: # it wasn't, it's optional, so...
python
def get_float(self, input_string): """ Return float type user input """ if input_string == '--training_fraction': # was the flag set? try: index = self.args.index(input_string) + 1 except ValueError: # it wasn't, it's optional, so...
[ "def", "get_float", "(", "self", ",", "input_string", ")", ":", "if", "input_string", "==", "'--training_fraction'", ":", "# was the flag set?", "try", ":", "index", "=", "self", ".", "args", ".", "index", "(", "input_string", ")", "+", "1", "except", "Value...
Return float type user input
[ "Return", "float", "type", "user", "input" ]
train
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/splitter/splitter_io.py#L130-L168
samuel-phan/mssh-copy-id
msshcopyid/utils.py
get_password
def get_password(from_stdin_only=False): """ Get a password either from STDIN or by prompting the user. :return: the password. """ if not sys.stdin.isatty(): password = sys.stdin.readline().strip() elif not from_stdin_only: password = getpass.getpass('Enter the password: ') ...
python
def get_password(from_stdin_only=False): """ Get a password either from STDIN or by prompting the user. :return: the password. """ if not sys.stdin.isatty(): password = sys.stdin.readline().strip() elif not from_stdin_only: password = getpass.getpass('Enter the password: ') ...
[ "def", "get_password", "(", "from_stdin_only", "=", "False", ")", ":", "if", "not", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "password", "=", "sys", ".", "stdin", ".", "readline", "(", ")", ".", "strip", "(", ")", "elif", "not", "from_stdin...
Get a password either from STDIN or by prompting the user. :return: the password.
[ "Get", "a", "password", "either", "from", "STDIN", "or", "by", "prompting", "the", "user", "." ]
train
https://github.com/samuel-phan/mssh-copy-id/blob/59c50eabb74c4e0eeb729266df57c285e6661b0b/msshcopyid/utils.py#L14-L27
samuel-phan/mssh-copy-id
msshcopyid/utils.py
parse_hosts
def parse_hosts(hosts, ssh_port=None, ssh_config=None): """ Parse a list of hosts (string) and return a list of `msshcopyid.Host` objects. The information about the host are taken in this order of priority: - host: - from the host (string) itself. - user: - from the host (string) i...
python
def parse_hosts(hosts, ssh_port=None, ssh_config=None): """ Parse a list of hosts (string) and return a list of `msshcopyid.Host` objects. The information about the host are taken in this order of priority: - host: - from the host (string) itself. - user: - from the host (string) i...
[ "def", "parse_hosts", "(", "hosts", ",", "ssh_port", "=", "None", ",", "ssh_config", "=", "None", ")", ":", "host_list", "=", "[", "]", "# list of Host objects", "current_user", "=", "getpass", ".", "getuser", "(", ")", "for", "host", "in", "hosts", ":", ...
Parse a list of hosts (string) and return a list of `msshcopyid.Host` objects. The information about the host are taken in this order of priority: - host: - from the host (string) itself. - user: - from the host (string) itself. - from the `paramiko.config.SSHConfig` object. ...
[ "Parse", "a", "list", "of", "hosts", "(", "string", ")", "and", "return", "a", "list", "of", "msshcopyid", ".", "Host", "objects", "." ]
train
https://github.com/samuel-phan/mssh-copy-id/blob/59c50eabb74c4e0eeb729266df57c285e6661b0b/msshcopyid/utils.py#L42-L84
roboogle/gtkmvc3
gtkmvco/examples/niew/view.py
_Abstract.connect_signals
def connect_signals(self, target): """ This is deprecated. Pass your controller to connect signals the old way. """ if self.connected: raise RuntimeError("GtkBuilder can only connect signals once") self.builder.connect_signals(target) self.connected = ...
python
def connect_signals(self, target): """ This is deprecated. Pass your controller to connect signals the old way. """ if self.connected: raise RuntimeError("GtkBuilder can only connect signals once") self.builder.connect_signals(target) self.connected = ...
[ "def", "connect_signals", "(", "self", ",", "target", ")", ":", "if", "self", ".", "connected", ":", "raise", "RuntimeError", "(", "\"GtkBuilder can only connect signals once\"", ")", "self", ".", "builder", ".", "connect_signals", "(", "target", ")", "self", "....
This is deprecated. Pass your controller to connect signals the old way.
[ "This", "is", "deprecated", ".", "Pass", "your", "controller", "to", "connect", "signals", "the", "old", "way", "." ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/niew/view.py#L71-L79
roboogle/gtkmvc3
gtkmvco/examples/niew/view.py
Widget.reparent
def reparent(self, other, name): """ Remove :meth:`get_toplevel` from any current parent and add it to *other[name]*. """ # http://developer.gnome.org/gtk-faq/stable/x635.html # warns against reparent() old = self.toplevel.get_parent() if old: ...
python
def reparent(self, other, name): """ Remove :meth:`get_toplevel` from any current parent and add it to *other[name]*. """ # http://developer.gnome.org/gtk-faq/stable/x635.html # warns against reparent() old = self.toplevel.get_parent() if old: ...
[ "def", "reparent", "(", "self", ",", "other", ",", "name", ")", ":", "# http://developer.gnome.org/gtk-faq/stable/x635.html", "# warns against reparent()", "old", "=", "self", ".", "toplevel", ".", "get_parent", "(", ")", "if", "old", ":", "old", ".", "remove", ...
Remove :meth:`get_toplevel` from any current parent and add it to *other[name]*.
[ "Remove", ":", "meth", ":", "get_toplevel", "from", "any", "current", "parent", "and", "add", "it", "to", "*", "other", "[", "name", "]", "*", "." ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/niew/view.py#L98-L109
siemens/django-dingos
dingos/filter.py
create_order_keyword_list
def create_order_keyword_list(keywords): """ Takes a given keyword list and returns a ready-to-go list of possible ordering values. Example: ['foo'] returns [('foo', ''), ('-foo', '')] """ result = [] for keyword in keywords: result.append((keyword, '')) result.append(('-%s...
python
def create_order_keyword_list(keywords): """ Takes a given keyword list and returns a ready-to-go list of possible ordering values. Example: ['foo'] returns [('foo', ''), ('-foo', '')] """ result = [] for keyword in keywords: result.append((keyword, '')) result.append(('-%s...
[ "def", "create_order_keyword_list", "(", "keywords", ")", ":", "result", "=", "[", "]", "for", "keyword", "in", "keywords", ":", "result", ".", "append", "(", "(", "keyword", ",", "''", ")", ")", "result", ".", "append", "(", "(", "'-%s'", "%", "keywor...
Takes a given keyword list and returns a ready-to-go list of possible ordering values. Example: ['foo'] returns [('foo', ''), ('-foo', '')]
[ "Takes", "a", "given", "keyword", "list", "and", "returns", "a", "ready", "-", "to", "-", "go", "list", "of", "possible", "ordering", "values", "." ]
train
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/filter.py#L36-L47
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
loads
def loads(s: str, **kwargs) -> JsonObj: """ Convert a json_str into a JsonObj :param s: a str instance containing a JSON document :param kwargs: arguments see: json.load for details :return: JsonObj representing the json string """ if isinstance(s, (bytes, bytearray)): s = s.decode(json...
python
def loads(s: str, **kwargs) -> JsonObj: """ Convert a json_str into a JsonObj :param s: a str instance containing a JSON document :param kwargs: arguments see: json.load for details :return: JsonObj representing the json string """ if isinstance(s, (bytes, bytearray)): s = s.decode(json...
[ "def", "loads", "(", "s", ":", "str", ",", "*", "*", "kwargs", ")", "->", "JsonObj", ":", "if", "isinstance", "(", "s", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "s", "=", "s", ".", "decode", "(", "json", ".", "detect_encoding", "(", ...
Convert a json_str into a JsonObj :param s: a str instance containing a JSON document :param kwargs: arguments see: json.load for details :return: JsonObj representing the json string
[ "Convert", "a", "json_str", "into", "a", "JsonObj" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L95-L104
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
load
def load(source, **kwargs) -> JsonObj: """ Deserialize a JSON source. :param source: a URI, File name or a .read()-supporting file-like object containing a JSON document :param kwargs: arguments. see: json.load for details :return: JsonObj representing fp """ if isinstance(source, str): ...
python
def load(source, **kwargs) -> JsonObj: """ Deserialize a JSON source. :param source: a URI, File name or a .read()-supporting file-like object containing a JSON document :param kwargs: arguments. see: json.load for details :return: JsonObj representing fp """ if isinstance(source, str): ...
[ "def", "load", "(", "source", ",", "*", "*", "kwargs", ")", "->", "JsonObj", ":", "if", "isinstance", "(", "source", ",", "str", ")", ":", "if", "'://'", "in", "source", ":", "req", "=", "Request", "(", "source", ")", "req", ".", "add_header", "(",...
Deserialize a JSON source. :param source: a URI, File name or a .read()-supporting file-like object containing a JSON document :param kwargs: arguments. see: json.load for details :return: JsonObj representing fp
[ "Deserialize", "a", "JSON", "source", "." ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L107-L128
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
as_json
def as_json(obj: JsonObj, indent: Optional[str]=' ', **kwargs) -> str: """ Convert obj to json string representation. :param obj: pseudo 'self' :param indent: indent argument to dumps :param kwargs: other arguments for dumps :return: JSON formatted string """ return obj...
python
def as_json(obj: JsonObj, indent: Optional[str]=' ', **kwargs) -> str: """ Convert obj to json string representation. :param obj: pseudo 'self' :param indent: indent argument to dumps :param kwargs: other arguments for dumps :return: JSON formatted string """ return obj...
[ "def", "as_json", "(", "obj", ":", "JsonObj", ",", "indent", ":", "Optional", "[", "str", "]", "=", "' '", ",", "*", "*", "kwargs", ")", "->", "str", ":", "return", "obj", ".", "_as_json_dumps", "(", "indent", ",", "*", "*", "kwargs", ")" ]
Convert obj to json string representation. :param obj: pseudo 'self' :param indent: indent argument to dumps :param kwargs: other arguments for dumps :return: JSON formatted string
[ "Convert", "obj", "to", "json", "string", "representation", "." ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L148-L156
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
get
def get(obj: JsonObj, item: str, default: JsonObjTypes=None) -> JsonObjTypes: """ Dictionary get routine """ return obj._get(item, default)
python
def get(obj: JsonObj, item: str, default: JsonObjTypes=None) -> JsonObjTypes: """ Dictionary get routine """ return obj._get(item, default)
[ "def", "get", "(", "obj", ":", "JsonObj", ",", "item", ":", "str", ",", "default", ":", "JsonObjTypes", "=", "None", ")", "->", "JsonObjTypes", ":", "return", "obj", ".", "_get", "(", "item", ",", "default", ")" ]
Dictionary get routine
[ "Dictionary", "get", "routine" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L167-L169
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
setdefault
def setdefault(obj: JsonObj, k: str, value: Union[Dict, JsonTypes]) -> JsonObjTypes: """ Dictionary setdefault reoutine """ return obj._setdefault(k, value)
python
def setdefault(obj: JsonObj, k: str, value: Union[Dict, JsonTypes]) -> JsonObjTypes: """ Dictionary setdefault reoutine """ return obj._setdefault(k, value)
[ "def", "setdefault", "(", "obj", ":", "JsonObj", ",", "k", ":", "str", ",", "value", ":", "Union", "[", "Dict", ",", "JsonTypes", "]", ")", "->", "JsonObjTypes", ":", "return", "obj", ".", "_setdefault", "(", "k", ",", "value", ")" ]
Dictionary setdefault reoutine
[ "Dictionary", "setdefault", "reoutine" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L172-L174
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
JsonObj._default
def _default(self, obj): """ return a serialized version of obj or raise a TypeError :param obj: :return: Serialized version of obj """ return obj.__dict__ if isinstance(obj, JsonObj) else json.JSONDecoder().decode(obj)
python
def _default(self, obj): """ return a serialized version of obj or raise a TypeError :param obj: :return: Serialized version of obj """ return obj.__dict__ if isinstance(obj, JsonObj) else json.JSONDecoder().decode(obj)
[ "def", "_default", "(", "self", ",", "obj", ")", ":", "return", "obj", ".", "__dict__", "if", "isinstance", "(", "obj", ",", "JsonObj", ")", "else", "json", ".", "JSONDecoder", "(", ")", ".", "decode", "(", "obj", ")" ]
return a serialized version of obj or raise a TypeError :param obj: :return: Serialized version of obj
[ "return", "a", "serialized", "version", "of", "obj", "or", "raise", "a", "TypeError" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L29-L35
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
JsonObj._items
def _items(self) -> List[Tuple[str, JsonObjTypes]]: """ Same as dict items() except that the values are JsonObjs instead of vanilla dictionaries :return: """ return [(k, self[k]) for k in self.__dict__.keys()]
python
def _items(self) -> List[Tuple[str, JsonObjTypes]]: """ Same as dict items() except that the values are JsonObjs instead of vanilla dictionaries :return: """ return [(k, self[k]) for k in self.__dict__.keys()]
[ "def", "_items", "(", "self", ")", "->", "List", "[", "Tuple", "[", "str", ",", "JsonObjTypes", "]", "]", ":", "return", "[", "(", "k", ",", "self", "[", "k", "]", ")", "for", "k", "in", "self", ".", "__dict__", ".", "keys", "(", ")", "]" ]
Same as dict items() except that the values are JsonObjs instead of vanilla dictionaries :return:
[ "Same", "as", "dict", "items", "()", "except", "that", "the", "values", "are", "JsonObjs", "instead", "of", "vanilla", "dictionaries", ":", "return", ":" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L49-L53
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
JsonObj._as_json
def _as_json(self, **kwargs) -> str: """ Convert a JsonObj into straight json text :param kwargs: json.dumps arguments :return: JSON formatted str """ return json.dumps(self, default=self._default, **kwargs)
python
def _as_json(self, **kwargs) -> str: """ Convert a JsonObj into straight json text :param kwargs: json.dumps arguments :return: JSON formatted str """ return json.dumps(self, default=self._default, **kwargs)
[ "def", "_as_json", "(", "self", ",", "*", "*", "kwargs", ")", "->", "str", ":", "return", "json", ".", "dumps", "(", "self", ",", "default", "=", "self", ".", "_default", ",", "*", "*", "kwargs", ")" ]
Convert a JsonObj into straight json text :param kwargs: json.dumps arguments :return: JSON formatted str
[ "Convert", "a", "JsonObj", "into", "straight", "json", "text" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L56-L62
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
JsonObj._as_json_dumps
def _as_json_dumps(self, indent: str=' ', **kwargs) -> str: """ Convert to a stringified json object. This is the same as _as_json with the exception that it isn't a property, meaning that we can actually pass arguments... :param indent: indent argument to dumps :param kwargs:...
python
def _as_json_dumps(self, indent: str=' ', **kwargs) -> str: """ Convert to a stringified json object. This is the same as _as_json with the exception that it isn't a property, meaning that we can actually pass arguments... :param indent: indent argument to dumps :param kwargs:...
[ "def", "_as_json_dumps", "(", "self", ",", "indent", ":", "str", "=", "' '", ",", "*", "*", "kwargs", ")", "->", "str", ":", "return", "json", ".", "dumps", "(", "self", ",", "default", "=", "self", ".", "_default", ",", "indent", "=", "indent", ...
Convert to a stringified json object. This is the same as _as_json with the exception that it isn't a property, meaning that we can actually pass arguments... :param indent: indent argument to dumps :param kwargs: other arguments for dumps :return: JSON formatted string
[ "Convert", "to", "a", "stringified", "json", "object", "." ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L64-L73
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
JsonObj.__as_list
def __as_list(value: List[JsonObjTypes]) -> List[JsonTypes]: """ Return a json array as a list :param value: array :return: array with JsonObj instances removed """ return [e._as_dict if isinstance(e, JsonObj) else e for e in value]
python
def __as_list(value: List[JsonObjTypes]) -> List[JsonTypes]: """ Return a json array as a list :param value: array :return: array with JsonObj instances removed """ return [e._as_dict if isinstance(e, JsonObj) else e for e in value]
[ "def", "__as_list", "(", "value", ":", "List", "[", "JsonObjTypes", "]", ")", "->", "List", "[", "JsonTypes", "]", ":", "return", "[", "e", ".", "_as_dict", "if", "isinstance", "(", "e", ",", "JsonObj", ")", "else", "e", "for", "e", "in", "value", ...
Return a json array as a list :param value: array :return: array with JsonObj instances removed
[ "Return", "a", "json", "array", "as", "a", "list" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L76-L82
hsolbrig/jsonasobj
src/jsonasobj/jsonobj.py
JsonObj._as_dict
def _as_dict(self) -> Dict[str, JsonTypes]: """ Convert a JsonObj into a straight dictionary :return: dictionary that cooresponds to the json object """ return {k: v._as_dict if isinstance(v, JsonObj) else self.__as_list(v) if isinstance(v, list) else ...
python
def _as_dict(self) -> Dict[str, JsonTypes]: """ Convert a JsonObj into a straight dictionary :return: dictionary that cooresponds to the json object """ return {k: v._as_dict if isinstance(v, JsonObj) else self.__as_list(v) if isinstance(v, list) else ...
[ "def", "_as_dict", "(", "self", ")", "->", "Dict", "[", "str", ",", "JsonTypes", "]", ":", "return", "{", "k", ":", "v", ".", "_as_dict", "if", "isinstance", "(", "v", ",", "JsonObj", ")", "else", "self", ".", "__as_list", "(", "v", ")", "if", "i...
Convert a JsonObj into a straight dictionary :return: dictionary that cooresponds to the json object
[ "Convert", "a", "JsonObj", "into", "a", "straight", "dictionary" ]
train
https://github.com/hsolbrig/jsonasobj/blob/13ac0838bb85d47bb6b8a667a4c2c69dba93e87d/src/jsonasobj/jsonobj.py#L85-L92
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/data.py
load
def load(text, match=None): """This function reads a string that contains the XML of an Atom Feed, then returns the data in a native Python structure (a ``dict`` or ``list``). If you also provide a tag name or path to match, only the matching sub-elements are loaded. :param text: The XML text t...
python
def load(text, match=None): """This function reads a string that contains the XML of an Atom Feed, then returns the data in a native Python structure (a ``dict`` or ``list``). If you also provide a tag name or path to match, only the matching sub-elements are loaded. :param text: The XML text t...
[ "def", "load", "(", "text", ",", "match", "=", "None", ")", ":", "if", "text", "is", "None", ":", "return", "None", "text", "=", "text", ".", "strip", "(", ")", "if", "len", "(", "text", ")", "==", "0", ":", "return", "None", "nametable", "=", ...
This function reads a string that contains the XML of an Atom Feed, then returns the data in a native Python structure (a ``dict`` or ``list``). If you also provide a tag name or path to match, only the matching sub-elements are loaded. :param text: The XML text to load. :type text: ``string`` ...
[ "This", "function", "reads", "a", "string", "that", "contains", "the", "XML", "of", "an", "Atom", "Feed", "then", "returns", "the", "data", "in", "a", "native", "Python", "structure", "(", "a", "dict", "or", "list", ")", ".", "If", "you", "also", "prov...
train
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/data.py#L58-L85
selectel/timecard
timecard/timecard.py
_MetricBase.render_value
def render_value(self, fix): """ Renders value for console output. :param bool fix: is a committed value? """ color = fix and _ansi["green_high"] or _ansi["green"] s = color + self._render_cell() + _ansi["reset"] return s
python
def render_value(self, fix): """ Renders value for console output. :param bool fix: is a committed value? """ color = fix and _ansi["green_high"] or _ansi["green"] s = color + self._render_cell() + _ansi["reset"] return s
[ "def", "render_value", "(", "self", ",", "fix", ")", ":", "color", "=", "fix", "and", "_ansi", "[", "\"green_high\"", "]", "or", "_ansi", "[", "\"green\"", "]", "s", "=", "color", "+", "self", ".", "_render_cell", "(", ")", "+", "_ansi", "[", "\"rese...
Renders value for console output. :param bool fix: is a committed value?
[ "Renders", "value", "for", "console", "output", ".", ":", "param", "bool", "fix", ":", "is", "a", "committed", "value?" ]
train
https://github.com/selectel/timecard/blob/cfbd14356511c8d7817750c22acf3164ff0030de/timecard/timecard.py#L91-L99
selectel/timecard
timecard/timecard.py
Timecard.write_headers
def write_headers(self): """ Output table header to console and csv file (if present). """ h1 = [] h2 = [] for m in self.values(): h2.append(m.render_subtitle()) h1.append(m.render_title()) stdout.write(" ".join(h1)) std...
python
def write_headers(self): """ Output table header to console and csv file (if present). """ h1 = [] h2 = [] for m in self.values(): h2.append(m.render_subtitle()) h1.append(m.render_title()) stdout.write(" ".join(h1)) std...
[ "def", "write_headers", "(", "self", ")", ":", "h1", "=", "[", "]", "h2", "=", "[", "]", "for", "m", "in", "self", ".", "values", "(", ")", ":", "h2", ".", "append", "(", "m", ".", "render_subtitle", "(", ")", ")", "h1", ".", "append", "(", "...
Output table header to console and csv file (if present).
[ "Output", "table", "header", "to", "console", "and", "csv", "file", "(", "if", "present", ")", "." ]
train
https://github.com/selectel/timecard/blob/cfbd14356511c8d7817750c22acf3164ff0030de/timecard/timecard.py#L522-L554
selectel/timecard
timecard/timecard.py
Timecard.write_line
def write_line(self, fix=True): """ Output line containing values to console and csv file. Only committed values are written to css file. :param bool fix: to commit measurement values """ cells = [] csv_values = [] for m in self.values(): ...
python
def write_line(self, fix=True): """ Output line containing values to console and csv file. Only committed values are written to css file. :param bool fix: to commit measurement values """ cells = [] csv_values = [] for m in self.values(): ...
[ "def", "write_line", "(", "self", ",", "fix", "=", "True", ")", ":", "cells", "=", "[", "]", "csv_values", "=", "[", "]", "for", "m", "in", "self", ".", "values", "(", ")", ":", "cells", ".", "append", "(", "m", ".", "render_value", "(", "fix", ...
Output line containing values to console and csv file. Only committed values are written to css file. :param bool fix: to commit measurement values
[ "Output", "line", "containing", "values", "to", "console", "and", "csv", "file", ".", "Only", "committed", "values", "are", "written", "to", "css", "file", ".", ":", "param", "bool", "fix", ":", "to", "commit", "measurement", "values" ]
train
https://github.com/selectel/timecard/blob/cfbd14356511c8d7817750c22acf3164ff0030de/timecard/timecard.py#L556-L592
FujiMakoto/AgentML
agentml/logger.py
InternalLogger.max_entries
def max_entries(self, entries): """ Chance the maximum number of retained log entries :param entries: The maximum number of log entries to retain at any given time :type entries: int """ self._debug_log.info('Changing maximum log entries from {old} to {new}' ...
python
def max_entries(self, entries): """ Chance the maximum number of retained log entries :param entries: The maximum number of log entries to retain at any given time :type entries: int """ self._debug_log.info('Changing maximum log entries from {old} to {new}' ...
[ "def", "max_entries", "(", "self", ",", "entries", ")", ":", "self", ".", "_debug_log", ".", "info", "(", "'Changing maximum log entries from {old} to {new}'", ".", "format", "(", "old", "=", "self", ".", "_log_entries", ",", "new", "=", "entries", ")", ")", ...
Chance the maximum number of retained log entries :param entries: The maximum number of log entries to retain at any given time :type entries: int
[ "Chance", "the", "maximum", "number", "of", "retained", "log", "entries", ":", "param", "entries", ":", "The", "maximum", "number", "of", "log", "entries", "to", "retain", "at", "any", "given", "time", ":", "type", "entries", ":", "int" ]
train
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/logger.py#L42-L57
FujiMakoto/AgentML
agentml/logger.py
InternalLogger.max_entries
def max_entries(self): """ Removes the maximum entry limit """ self._debug_log.info('Removing maximum entries restriction') self._log_entries(deque(self._log_entries))
python
def max_entries(self): """ Removes the maximum entry limit """ self._debug_log.info('Removing maximum entries restriction') self._log_entries(deque(self._log_entries))
[ "def", "max_entries", "(", "self", ")", ":", "self", ".", "_debug_log", ".", "info", "(", "'Removing maximum entries restriction'", ")", "self", ".", "_log_entries", "(", "deque", "(", "self", ".", "_log_entries", ")", ")" ]
Removes the maximum entry limit
[ "Removes", "the", "maximum", "entry", "limit" ]
train
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/logger.py#L60-L65
FujiMakoto/AgentML
agentml/logger.py
RequestLogger.add
def add(self, user, message, groups): """ Add a new log entry :param user: The requesting user :type user: agentml.User :param message: The request Message instance :type message: agentml.Message :param groups: The request groups :type groups: set ...
python
def add(self, user, message, groups): """ Add a new log entry :param user: The requesting user :type user: agentml.User :param message: The request Message instance :type message: agentml.Message :param groups: The request groups :type groups: set ...
[ "def", "add", "(", "self", ",", "user", ",", "message", ",", "groups", ")", ":", "self", ".", "_debug_log", ".", "debug", "(", "'Logging new Request entry'", ")", "request", "=", "Request", "(", "user", ",", "message", ",", "groups", ")", "self", ".", ...
Add a new log entry :param user: The requesting user :type user: agentml.User :param message: The request Message instance :type message: agentml.Message :param groups: The request groups :type groups: set :return: The logged Request instance :rtype ...
[ "Add", "a", "new", "log", "entry", ":", "param", "user", ":", "The", "requesting", "user", ":", "type", "user", ":", "agentml", ".", "User" ]
train
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/logger.py#L81-L99
FujiMakoto/AgentML
agentml/logger.py
ResponseLogger.add
def add(self, message, request): """ Add a new log entry :param message: The request message :type message: str :param request: The Request associated with this response :type request: Request or None :return: The logged Response instance :rtype : Resp...
python
def add(self, message, request): """ Add a new log entry :param message: The request message :type message: str :param request: The Request associated with this response :type request: Request or None :return: The logged Response instance :rtype : Resp...
[ "def", "add", "(", "self", ",", "message", ",", "request", ")", ":", "self", ".", "_debug_log", ".", "debug", "(", "'Logging new Response entry'", ")", "response", "=", "Response", "(", "message", ",", "request", ")", "self", ".", "_log_entries", ".", "app...
Add a new log entry :param message: The request message :type message: str :param request: The Request associated with this response :type request: Request or None :return: The logged Response instance :rtype : Response
[ "Add", "a", "new", "log", "entry", ":", "param", "message", ":", "The", "request", "message", ":", "type", "message", ":", "str" ]
train
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/logger.py#L140-L155
avanwyk/cipy
examples/gc_pso.py
main
def main(dimension, iterations): """ Main function to execute gbest GC PSO algorithm. """ objective_function = minimize(functions.sphere) stopping_condition = max_iterations(iterations) (solution, metrics) = optimize(objective_function=objective_function, domain=Do...
python
def main(dimension, iterations): """ Main function to execute gbest GC PSO algorithm. """ objective_function = minimize(functions.sphere) stopping_condition = max_iterations(iterations) (solution, metrics) = optimize(objective_function=objective_function, domain=Do...
[ "def", "main", "(", "dimension", ",", "iterations", ")", ":", "objective_function", "=", "minimize", "(", "functions", ".", "sphere", ")", "stopping_condition", "=", "max_iterations", "(", "iterations", ")", "(", "solution", ",", "metrics", ")", "=", "optimize...
Main function to execute gbest GC PSO algorithm.
[ "Main", "function", "to", "execute", "gbest", "GC", "PSO", "algorithm", "." ]
train
https://github.com/avanwyk/cipy/blob/98450dd01767b3615c113e50dc396f135e177b29/examples/gc_pso.py#L27-L40
mensi/gittornado
gittornado/iowrapper.py
ProcessWrapper.read_chunks
def read_chunks(self): """Read chunks from the HTTP client""" if self.reading_chunks and self.got_chunk: # we got on the fast-path and directly read from the buffer. # if we continue to recurse, this is going to blow up the stack. # so instead return # ...
python
def read_chunks(self): """Read chunks from the HTTP client""" if self.reading_chunks and self.got_chunk: # we got on the fast-path and directly read from the buffer. # if we continue to recurse, this is going to blow up the stack. # so instead return # ...
[ "def", "read_chunks", "(", "self", ")", ":", "if", "self", ".", "reading_chunks", "and", "self", ".", "got_chunk", ":", "# we got on the fast-path and directly read from the buffer.", "# if we continue to recurse, this is going to blow up the stack.", "# so instead return", "#", ...
Read chunks from the HTTP client
[ "Read", "chunks", "from", "the", "HTTP", "client" ]
train
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/iowrapper.py#L139-L171
mensi/gittornado
gittornado/iowrapper.py
ProcessWrapper._chunk_length
def _chunk_length(self, data): """Received the chunk length""" assert data[-2:] == "\r\n", "CRLF" length = data[:-2].split(';')[0] # cut off optional length paramters length = int(length.strip(), 16) # length is in hex if length: logger.debug('Got chunk length: %d'...
python
def _chunk_length(self, data): """Received the chunk length""" assert data[-2:] == "\r\n", "CRLF" length = data[:-2].split(';')[0] # cut off optional length paramters length = int(length.strip(), 16) # length is in hex if length: logger.debug('Got chunk length: %d'...
[ "def", "_chunk_length", "(", "self", ",", "data", ")", ":", "assert", "data", "[", "-", "2", ":", "]", "==", "\"\\r\\n\"", ",", "\"CRLF\"", "length", "=", "data", "[", ":", "-", "2", "]", ".", "split", "(", "';'", ")", "[", "0", "]", "# cut off o...
Received the chunk length
[ "Received", "the", "chunk", "length" ]
train
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/iowrapper.py#L173-L189
mensi/gittornado
gittornado/iowrapper.py
ProcessWrapper._chunk_data
def _chunk_data(self, data): """Received chunk data""" assert data[-2:] == "\r\n", "CRLF" if self.gzip_decompressor: if not self.gzip_header_seen: assert data[:2] == '\x1f\x8b', "gzip header" self.gzip_header_seen = True self.process_inp...
python
def _chunk_data(self, data): """Received chunk data""" assert data[-2:] == "\r\n", "CRLF" if self.gzip_decompressor: if not self.gzip_header_seen: assert data[:2] == '\x1f\x8b', "gzip header" self.gzip_header_seen = True self.process_inp...
[ "def", "_chunk_data", "(", "self", ",", "data", ")", ":", "assert", "data", "[", "-", "2", ":", "]", "==", "\"\\r\\n\"", ",", "\"CRLF\"", "if", "self", ".", "gzip_decompressor", ":", "if", "not", "self", ".", "gzip_header_seen", ":", "assert", "data", ...
Received chunk data
[ "Received", "chunk", "data" ]
train
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/iowrapper.py#L191-L215
mensi/gittornado
gittornado/iowrapper.py
ProcessWrapper._handle_stdin_event
def _handle_stdin_event(self, fd, events): """Eventhandler for stdin""" assert fd == self.fd_stdin if events & self.ioloop.ERROR: # An error at the end is expected since tornado maps HUP to ERROR logger.debug('Error on stdin') # ensure pipe is closed ...
python
def _handle_stdin_event(self, fd, events): """Eventhandler for stdin""" assert fd == self.fd_stdin if events & self.ioloop.ERROR: # An error at the end is expected since tornado maps HUP to ERROR logger.debug('Error on stdin') # ensure pipe is closed ...
[ "def", "_handle_stdin_event", "(", "self", ",", "fd", ",", "events", ")", ":", "assert", "fd", "==", "self", ".", "fd_stdin", "if", "events", "&", "self", ".", "ioloop", ".", "ERROR", ":", "# An error at the end is expected since tornado maps HUP to ERROR", "logge...
Eventhandler for stdin
[ "Eventhandler", "for", "stdin" ]
train
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/iowrapper.py#L217-L254
mensi/gittornado
gittornado/iowrapper.py
ProcessWrapper._handle_stdout_event
def _handle_stdout_event(self, fd, events): """Eventhandler for stdout""" assert fd == self.fd_stdout if events & self.ioloop.READ: # got data ready to read data = '' # Now basically we have two cases: either the client supports # HTTP/1.1 in wh...
python
def _handle_stdout_event(self, fd, events): """Eventhandler for stdout""" assert fd == self.fd_stdout if events & self.ioloop.READ: # got data ready to read data = '' # Now basically we have two cases: either the client supports # HTTP/1.1 in wh...
[ "def", "_handle_stdout_event", "(", "self", ",", "fd", ",", "events", ")", ":", "assert", "fd", "==", "self", ".", "fd_stdout", "if", "events", "&", "self", ".", "ioloop", ".", "READ", ":", "# got data ready to read", "data", "=", "''", "# Now basically we h...
Eventhandler for stdout
[ "Eventhandler", "for", "stdout" ]
train
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/iowrapper.py#L256-L328
mensi/gittornado
gittornado/iowrapper.py
ProcessWrapper._handle_stderr_event
def _handle_stderr_event(self, fd, events): """Eventhandler for stderr""" assert fd == self.fd_stderr if events & self.ioloop.READ: # got data ready if not self.headers_sent: payload = self.process.stderr.read() data = 'HTTP/1.1 500 Inte...
python
def _handle_stderr_event(self, fd, events): """Eventhandler for stderr""" assert fd == self.fd_stderr if events & self.ioloop.READ: # got data ready if not self.headers_sent: payload = self.process.stderr.read() data = 'HTTP/1.1 500 Inte...
[ "def", "_handle_stderr_event", "(", "self", ",", "fd", ",", "events", ")", ":", "assert", "fd", "==", "self", ".", "fd_stderr", "if", "events", "&", "self", ".", "ioloop", ".", "READ", ":", "# got data ready", "if", "not", "self", ".", "headers_sent", ":...
Eventhandler for stderr
[ "Eventhandler", "for", "stderr" ]
train
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/iowrapper.py#L330-L359
mensi/gittornado
gittornado/iowrapper.py
ProcessWrapper._graceful_finish
def _graceful_finish(self): """Detect if process has closed pipes and we can finish""" if not self.process.stdout.closed or not self.process.stderr.closed: return # stdout/stderr still open if not self.process.stdin.closed: self.process.stdin.close() if self.nu...
python
def _graceful_finish(self): """Detect if process has closed pipes and we can finish""" if not self.process.stdout.closed or not self.process.stderr.closed: return # stdout/stderr still open if not self.process.stdin.closed: self.process.stdin.close() if self.nu...
[ "def", "_graceful_finish", "(", "self", ")", ":", "if", "not", "self", ".", "process", ".", "stdout", ".", "closed", "or", "not", "self", ".", "process", ".", "stderr", ".", "closed", ":", "return", "# stdout/stderr still open", "if", "not", "self", ".", ...
Detect if process has closed pipes and we can finish
[ "Detect", "if", "process", "has", "closed", "pipes", "and", "we", "can", "finish" ]
train
https://github.com/mensi/gittornado/blob/adf86b5537064337c806cce0e71eacaabc8bb610/gittornado/iowrapper.py#L361-L396
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._genTimeoutList
def _genTimeoutList(self, const): """ Generates a dict of the valid timeout values for the given `const`. The `const` value may change for different versions or types of Pololu boards. """ result = {} for v in range(128): x = v & 0x0F y = ...
python
def _genTimeoutList(self, const): """ Generates a dict of the valid timeout values for the given `const`. The `const` value may change for different versions or types of Pololu boards. """ result = {} for v in range(128): x = v & 0x0F y = ...
[ "def", "_genTimeoutList", "(", "self", ",", "const", ")", ":", "result", "=", "{", "}", "for", "v", "in", "range", "(", "128", ")", ":", "x", "=", "v", "&", "0x0F", "y", "=", "(", "v", ">>", "4", ")", "&", "0x07", "if", "not", "y", "or", "(...
Generates a dict of the valid timeout values for the given `const`. The `const` value may change for different versions or types of Pololu boards.
[ "Generates", "a", "dict", "of", "the", "valid", "timeout", "values", "for", "the", "given", "const", ".", "The", "const", "value", "may", "change", "for", "different", "versions", "or", "types", "of", "Pololu", "boards", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L55-L71
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik.findConnectedDevices
def findConnectedDevices(self): """ Find all the devices on the serial buss and store the results in a class member object. """ tmpTimeout = self._serial.timeout self._serial.timeout = 0.01 for dev in range(128): device = self._getDeviceID(dev) ...
python
def findConnectedDevices(self): """ Find all the devices on the serial buss and store the results in a class member object. """ tmpTimeout = self._serial.timeout self._serial.timeout = 0.01 for dev in range(128): device = self._getDeviceID(dev) ...
[ "def", "findConnectedDevices", "(", "self", ")", ":", "tmpTimeout", "=", "self", ".", "_serial", ".", "timeout", "self", ".", "_serial", ".", "timeout", "=", "0.01", "for", "dev", "in", "range", "(", "128", ")", ":", "device", "=", "self", ".", "_getDe...
Find all the devices on the serial buss and store the results in a class member object.
[ "Find", "all", "the", "devices", "on", "the", "serial", "buss", "and", "store", "the", "results", "in", "a", "class", "member", "object", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L73-L90
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik.setCompactProtocol
def setCompactProtocol(self): """ Set the compact protocol. """ self._compact = True self._serial.write(bytes(self._BAUD_DETECT)) self._log and self._log.debug("Compact protocol has been set.")
python
def setCompactProtocol(self): """ Set the compact protocol. """ self._compact = True self._serial.write(bytes(self._BAUD_DETECT)) self._log and self._log.debug("Compact protocol has been set.")
[ "def", "setCompactProtocol", "(", "self", ")", ":", "self", ".", "_compact", "=", "True", "self", ".", "_serial", ".", "write", "(", "bytes", "(", "self", ".", "_BAUD_DETECT", ")", ")", "self", ".", "_log", "and", "self", ".", "_log", ".", "debug", "...
Set the compact protocol.
[ "Set", "the", "compact", "protocol", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L121-L127
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik.setPololuProtocol
def setPololuProtocol(self): """ Set the pololu protocol. """ self._compact = False self._log and self._log.debug("Pololu protocol has been set.")
python
def setPololuProtocol(self): """ Set the pololu protocol. """ self._compact = False self._log and self._log.debug("Pololu protocol has been set.")
[ "def", "setPololuProtocol", "(", "self", ")", ":", "self", ".", "_compact", "=", "False", "self", ".", "_log", "and", "self", ".", "_log", ".", "debug", "(", "\"Pololu protocol has been set.\"", ")" ]
Set the pololu protocol.
[ "Set", "the", "pololu", "protocol", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L139-L144
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._writeData
def _writeData(self, command, device, params=()): """ Write the data to the device. :Parameters: command : `int` The command to write to the device. device : `int` The device is the integer number of the hardware devices ID and is only use...
python
def _writeData(self, command, device, params=()): """ Write the data to the device. :Parameters: command : `int` The command to write to the device. device : `int` The device is the integer number of the hardware devices ID and is only use...
[ "def", "_writeData", "(", "self", ",", "command", ",", "device", ",", "params", "=", "(", ")", ")", ":", "sequence", "=", "[", "]", "if", "self", ".", "_compact", ":", "sequence", ".", "append", "(", "command", "|", "0x80", ")", "else", ":", "seque...
Write the data to the device. :Parameters: command : `int` The command to write to the device. device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. params : `tuple` Seq...
[ "Write", "the", "data", "to", "the", "device", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L175-L211
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._getFirmwareVersion
def _getFirmwareVersion(self, device): """ Get the firmware version. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. :Returns: An integer indicating the versio...
python
def _getFirmwareVersion(self, device): """ Get the firmware version. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. :Returns: An integer indicating the versio...
[ "def", "_getFirmwareVersion", "(", "self", ",", "device", ")", ":", "cmd", "=", "self", ".", "_COMMAND", ".", "get", "(", "'get-fw-version'", ")", "self", ".", "_writeData", "(", "cmd", ",", "device", ")", "try", ":", "result", "=", "self", ".", "_seri...
Get the firmware version. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. :Returns: An integer indicating the version number.
[ "Get", "the", "firmware", "version", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L213-L237
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._getError
def _getError(self, device, message): """ Get the error message or value stored in the Qik hardware. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. message : `bool` ...
python
def _getError(self, device, message): """ Get the error message or value stored in the Qik hardware. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. message : `bool` ...
[ "def", "_getError", "(", "self", ",", "device", ",", "message", ")", ":", "cmd", "=", "self", ".", "_COMMAND", ".", "get", "(", "'get-error'", ")", "self", ".", "_writeData", "(", "cmd", ",", "device", ")", "result", "=", "[", "]", "bits", "=", "["...
Get the error message or value stored in the Qik hardware. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. message : `bool` If set to `True` a text message will be returned...
[ "Get", "the", "error", "message", "or", "value", "stored", "in", "the", "Qik", "hardware", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L239-L278
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._getConfig
def _getConfig(self, num, device): """ Low level method used for all get config commands. :Parameters: num : `int` Number that indicates the config option to get from the hardware. device : `int` The device is the integer number of the hardware device...
python
def _getConfig(self, num, device): """ Low level method used for all get config commands. :Parameters: num : `int` Number that indicates the config option to get from the hardware. device : `int` The device is the integer number of the hardware device...
[ "def", "_getConfig", "(", "self", ",", "num", ",", "device", ")", ":", "cmd", "=", "self", ".", "_COMMAND", ".", "get", "(", "'get-config'", ")", "self", ".", "_writeData", "(", "cmd", ",", "device", ",", "params", "=", "(", "num", ",", ")", ")", ...
Low level method used for all get config commands. :Parameters: num : `int` Number that indicates the config option to get from the hardware. device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Proto...
[ "Low", "level", "method", "used", "for", "all", "get", "config", "commands", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L280-L306
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._getPWMFrequency
def _getPWMFrequency(self, device, message): """ Get the PWM frequency stored on the hardware device. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. message : `bool` ...
python
def _getPWMFrequency(self, device, message): """ Get the PWM frequency stored on the hardware device. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. message : `bool` ...
[ "def", "_getPWMFrequency", "(", "self", ",", "device", ",", "message", ")", ":", "result", "=", "self", ".", "_getConfig", "(", "self", ".", "PWM_PARAM", ",", "device", ")", "freq", ",", "msg", "=", "self", ".", "_CONFIG_PWM", ".", "get", "(", "result"...
Get the PWM frequency stored on the hardware device. :Parameters: device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. message : `bool` If set to `True` a text message will be returned, if s...
[ "Get", "the", "PWM", "frequency", "stored", "on", "the", "hardware", "device", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L322-L345
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._getSerialTimeout
def _getSerialTimeout(self, device): """ Get the serial timeout stored on the hardware device. Caution, more that one value returned from the Qik can have the same actual timeout value according the the formula below. I have verified this as an idiosyncrasy of the Qik itself. Th...
python
def _getSerialTimeout(self, device): """ Get the serial timeout stored on the hardware device. Caution, more that one value returned from the Qik can have the same actual timeout value according the the formula below. I have verified this as an idiosyncrasy of the Qik itself. Th...
[ "def", "_getSerialTimeout", "(", "self", ",", "device", ")", ":", "num", "=", "self", ".", "_getConfig", "(", "self", ".", "SERIAL_TIMEOUT", ",", "device", ")", "if", "isinstance", "(", "num", ",", "int", ")", ":", "x", "=", "num", "&", "0x0F", "y", ...
Get the serial timeout stored on the hardware device. Caution, more that one value returned from the Qik can have the same actual timeout value according the the formula below. I have verified this as an idiosyncrasy of the Qik itself. There are only a total of 72 unique values that the...
[ "Get", "the", "serial", "timeout", "stored", "on", "the", "hardware", "device", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L361-L388
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._setConfig
def _setConfig(self, num, value, device, message): """ Low level method used for all set config commands. :Parameters: num : `int` Number that indicates the config option to get from the hardware. value : `int` The value to set in the hardware device....
python
def _setConfig(self, num, value, device, message): """ Low level method used for all set config commands. :Parameters: num : `int` Number that indicates the config option to get from the hardware. value : `int` The value to set in the hardware device....
[ "def", "_setConfig", "(", "self", ",", "num", ",", "value", ",", "device", ",", "message", ")", ":", "cmd", "=", "self", ".", "_COMMAND", ".", "get", "(", "'set-config'", ")", "self", ".", "_writeData", "(", "cmd", ",", "device", ",", "params", "=", ...
Low level method used for all set config commands. :Parameters: num : `int` Number that indicates the config option to get from the hardware. value : `int` The value to set in the hardware device. device : `int` The device is the integer number ...
[ "Low", "level", "method", "used", "for", "all", "set", "config", "commands", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L390-L430
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._setDeviceID
def _setDeviceID(self, value, device, message): """ Set the hardware device number. This is only needed if more that one device is on the same serial buss. :Parameters: value : `int` The device ID to set in the range of 0 - 127. device : `int` ...
python
def _setDeviceID(self, value, device, message): """ Set the hardware device number. This is only needed if more that one device is on the same serial buss. :Parameters: value : `int` The device ID to set in the range of 0 - 127. device : `int` ...
[ "def", "_setDeviceID", "(", "self", ",", "value", ",", "device", ",", "message", ")", ":", "if", "value", "!=", "device", ":", "result", "=", "self", ".", "_setConfig", "(", "self", ".", "DEVICE_ID", ",", "value", ",", "device", ",", "message", ")", ...
Set the hardware device number. This is only needed if more that one device is on the same serial buss. :Parameters: value : `int` The device ID to set in the range of 0 - 127. device : `int` The device is the integer number of the hardware devices ID and ...
[ "Set", "the", "hardware", "device", "number", ".", "This", "is", "only", "needed", "if", "more", "that", "one", "device", "is", "on", "the", "same", "serial", "buss", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L432-L460
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._setPWMFrequency
def _setPWMFrequency(self, pwm, device, message): """ Set the PWM frequency. :Parameters: pwm : `int` The PWN frequency to set in hertz. device : `int` The device is the integer number of the hardware devices ID and is only used with the P...
python
def _setPWMFrequency(self, pwm, device, message): """ Set the PWM frequency. :Parameters: pwm : `int` The PWN frequency to set in hertz. device : `int` The device is the integer number of the hardware devices ID and is only used with the P...
[ "def", "_setPWMFrequency", "(", "self", ",", "pwm", ",", "device", ",", "message", ")", ":", "value", "=", "self", ".", "_CONFIG_PWM_TO_VALUE", ".", "get", "(", "pwm", ")", "if", "value", "is", "None", ":", "msg", "=", "\"Invalid frequency: {}\"", ".", "...
Set the PWM frequency. :Parameters: pwm : `int` The PWN frequency to set in hertz. device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. message : `bool` If set to `True...
[ "Set", "the", "PWM", "frequency", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L462-L487
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._setMotorShutdown
def _setMotorShutdown(self, value, device, message): """ Set the motor shutdown on error status stored on the hardware device. :Parameters: value : `int` An integer indicating the effect on the motors when an error occurs. device : `int` The device is...
python
def _setMotorShutdown(self, value, device, message): """ Set the motor shutdown on error status stored on the hardware device. :Parameters: value : `int` An integer indicating the effect on the motors when an error occurs. device : `int` The device is...
[ "def", "_setMotorShutdown", "(", "self", ",", "value", ",", "device", ",", "message", ")", ":", "value", "=", "self", ".", "_BOOL_TO_INT", ".", "get", "(", "value", ",", "1", ")", "self", ".", "_deviceConfig", "[", "device", "]", "[", "'shutdown'", "]"...
Set the motor shutdown on error status stored on the hardware device. :Parameters: value : `int` An integer indicating the effect on the motors when an error occurs. device : `int` The device is the integer number of the hardware devices ID and is only us...
[ "Set", "the", "motor", "shutdown", "on", "error", "status", "stored", "on", "the", "hardware", "device", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L489-L508
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._setSerialTimeout
def _setSerialTimeout(self, timeout, device, message): """ Set the serial timeout on the hardware device. :Parameters: timeout : `float` or `int` The timeout value as defined by the hardware manual. device : `int` The device is the integer number of t...
python
def _setSerialTimeout(self, timeout, device, message): """ Set the serial timeout on the hardware device. :Parameters: timeout : `float` or `int` The timeout value as defined by the hardware manual. device : `int` The device is the integer number of t...
[ "def", "_setSerialTimeout", "(", "self", ",", "timeout", ",", "device", ",", "message", ")", ":", "timeout", "=", "min", "(", "self", ".", "_timeoutKeys", ",", "key", "=", "lambda", "x", ":", "abs", "(", "x", "-", "timeout", ")", ")", "value", "=", ...
Set the serial timeout on the hardware device. :Parameters: timeout : `float` or `int` The timeout value as defined by the hardware manual. device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protoco...
[ "Set", "the", "serial", "timeout", "on", "the", "hardware", "device", "." ]
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L510-L530
cnobile2012/pololu-motors
pololu/motors/qik.py
Qik._setSpeed
def _setSpeed(self, speed, motor, device): """ Set motor speed. This method takes into consideration the PWM frequency that the hardware is currently running at and limits the values passed to the hardware accordingly. :Parameters: speed : `int` Motor speed...
python
def _setSpeed(self, speed, motor, device): """ Set motor speed. This method takes into consideration the PWM frequency that the hardware is currently running at and limits the values passed to the hardware accordingly. :Parameters: speed : `int` Motor speed...
[ "def", "_setSpeed", "(", "self", ",", "speed", ",", "motor", ",", "device", ")", ":", "reverse", "=", "False", "if", "speed", "<", "0", ":", "speed", "=", "-", "speed", "reverse", "=", "True", "# 0 and 2 for Qik 2s9v1, 0, 2, and 4 for 2s12v10", "if", "self",...
Set motor speed. This method takes into consideration the PWM frequency that the hardware is currently running at and limits the values passed to the hardware accordingly. :Parameters: speed : `int` Motor speed as an integer. Negative numbers indicate reverse s...
[ "Set", "motor", "speed", ".", "This", "method", "takes", "into", "consideration", "the", "PWM", "frequency", "that", "the", "hardware", "is", "currently", "running", "at", "and", "limits", "the", "values", "passed", "to", "the", "hardware", "accordingly", "." ...
train
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L558-L605
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_key_names
def get_key_names(self): """ Gets keys of all elements stored in this map. :return: a list with all map keys. """ names = [] for (k, _) in self.items(): names.append(k) return names
python
def get_key_names(self): """ Gets keys of all elements stored in this map. :return: a list with all map keys. """ names = [] for (k, _) in self.items(): names.append(k) return names
[ "def", "get_key_names", "(", "self", ")", ":", "names", "=", "[", "]", "for", "(", "k", ",", "_", ")", "in", "self", ".", "items", "(", ")", ":", "names", ".", "append", "(", "k", ")", "return", "names" ]
Gets keys of all elements stored in this map. :return: a list with all map keys.
[ "Gets", "keys", "of", "all", "elements", "stored", "in", "this", "map", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L46-L55
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.append
def append(self, map): """ Appends new elements to this map. :param map: a map with elements to be added. """ if isinstance(map, dict): for (k, v) in map.items(): key = StringConverter.to_string(k) value = v self.put(ke...
python
def append(self, map): """ Appends new elements to this map. :param map: a map with elements to be added. """ if isinstance(map, dict): for (k, v) in map.items(): key = StringConverter.to_string(k) value = v self.put(ke...
[ "def", "append", "(", "self", ",", "map", ")", ":", "if", "isinstance", "(", "map", ",", "dict", ")", ":", "for", "(", "k", ",", "v", ")", "in", "map", ".", "items", "(", ")", ":", "key", "=", "StringConverter", ".", "to_string", "(", "k", ")",...
Appends new elements to this map. :param map: a map with elements to be added.
[ "Appends", "new", "elements", "to", "this", "map", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L86-L96
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.set_as_object
def set_as_object(self, value): """ Sets a new value to map element :param value: a new element or map value. """ self.clear() map = MapConverter.to_map(value) self.append(map)
python
def set_as_object(self, value): """ Sets a new value to map element :param value: a new element or map value. """ self.clear() map = MapConverter.to_map(value) self.append(map)
[ "def", "set_as_object", "(", "self", ",", "value", ")", ":", "self", ".", "clear", "(", ")", "map", "=", "MapConverter", ".", "to_map", "(", "value", ")", "self", ".", "append", "(", "map", ")" ]
Sets a new value to map element :param value: a new element or map value.
[ "Sets", "a", "new", "value", "to", "map", "element" ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L112-L120
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_map
def get_as_map(self, key): """ Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. :param key: a key of element to get. :return: AnyValueMap value of the element or empty AnyValueMap if conversion is not supported. """ va...
python
def get_as_map(self, key): """ Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. :param key: a key of element to get. :return: AnyValueMap value of the element or empty AnyValueMap if conversion is not supported. """ va...
[ "def", "get_as_map", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "AnyValueMap", ".", "from_value", "(", "value", ")" ]
Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. :param key: a key of element to get. :return: AnyValueMap value of the element or empty AnyValueMap if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "AnyValueMap", "or", "returns", "empty", "AnyValueMap", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L134-L143
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_nullable_string
def get_as_nullable_string(self, key): """ Converts map element into a string or returns None if conversion is not possible. :param key: an index of element to get. :return: string value of the element or None if conversion is not supported. """ value = self.get(key) ...
python
def get_as_nullable_string(self, key): """ Converts map element into a string or returns None if conversion is not possible. :param key: an index of element to get. :return: string value of the element or None if conversion is not supported. """ value = self.get(key) ...
[ "def", "get_as_nullable_string", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "StringConverter", ".", "to_nullable_string", "(", "value", ")" ]
Converts map element into a string or returns None if conversion is not possible. :param key: an index of element to get. :return: string value of the element or None if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "string", "or", "returns", "None", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L164-L173
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_string
def get_as_string(self, key): """ Converts map element into a string or returns "" if conversion is not possible. :param key: an index of element to get. :return: string value ot the element or "" if conversion is not supported. """ value = self.get(key) return ...
python
def get_as_string(self, key): """ Converts map element into a string or returns "" if conversion is not possible. :param key: an index of element to get. :return: string value ot the element or "" if conversion is not supported. """ value = self.get(key) return ...
[ "def", "get_as_string", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "StringConverter", ".", "to_string", "(", "value", ")" ]
Converts map element into a string or returns "" if conversion is not possible. :param key: an index of element to get. :return: string value ot the element or "" if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "string", "or", "returns", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L175-L184
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_string_with_default
def get_as_string_with_default(self, key, default_value): """ Converts map element into a string or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: string value ot the element or defa...
python
def get_as_string_with_default(self, key, default_value): """ Converts map element into a string or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: string value ot the element or defa...
[ "def", "get_as_string_with_default", "(", "self", ",", "key", ",", "default_value", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "StringConverter", ".", "to_string_with_default", "(", "value", ",", "default_value", ")" ]
Converts map element into a string or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: string value ot the element or default value if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "string", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L186-L197
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_nullable_boolean
def get_as_nullable_boolean(self, key): """ Converts map element into a boolean or returns None if conversion is not possible :param key: an index of element to get. :return: boolean value of the element or None if conversion is not supported. """ value = self.get(key) ...
python
def get_as_nullable_boolean(self, key): """ Converts map element into a boolean or returns None if conversion is not possible :param key: an index of element to get. :return: boolean value of the element or None if conversion is not supported. """ value = self.get(key) ...
[ "def", "get_as_nullable_boolean", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "BooleanConverter", ".", "to_nullable_boolean", "(", "value", ")" ]
Converts map element into a boolean or returns None if conversion is not possible :param key: an index of element to get. :return: boolean value of the element or None if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "boolean", "or", "returns", "None", "if", "conversion", "is", "not", "possible" ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L199-L208
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_boolean
def get_as_boolean(self, key): """ Converts map element into a boolean or returns false if conversion is not possible. :param key: an index of element to get. :return: boolean value ot the element or false if conversion is not supported. """ value = self.get(key) ...
python
def get_as_boolean(self, key): """ Converts map element into a boolean or returns false if conversion is not possible. :param key: an index of element to get. :return: boolean value ot the element or false if conversion is not supported. """ value = self.get(key) ...
[ "def", "get_as_boolean", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "BooleanConverter", ".", "to_boolean", "(", "value", ")" ]
Converts map element into a boolean or returns false if conversion is not possible. :param key: an index of element to get. :return: boolean value ot the element or false if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "boolean", "or", "returns", "false", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L210-L219
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_boolean_with_default
def get_as_boolean_with_default(self, key, default_value): """ Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or d...
python
def get_as_boolean_with_default(self, key, default_value): """ Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or d...
[ "def", "get_as_boolean_with_default", "(", "self", ",", "key", ",", "default_value", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "BooleanConverter", ".", "to_boolean_with_default", "(", "value", ",", "default_value", ")" ]
Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or default value if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "boolean", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L221-L232
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_nullable_integer
def get_as_nullable_integer(self, key): """ Converts map element into an integer or returns None if conversion is not possible. :param key: an index of element to get. :return: integer value of the element or None if conversion is not supported. """ value = self.get(key...
python
def get_as_nullable_integer(self, key): """ Converts map element into an integer or returns None if conversion is not possible. :param key: an index of element to get. :return: integer value of the element or None if conversion is not supported. """ value = self.get(key...
[ "def", "get_as_nullable_integer", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "IntegerConverter", ".", "to_nullable_integer", "(", "value", ")" ]
Converts map element into an integer or returns None if conversion is not possible. :param key: an index of element to get. :return: integer value of the element or None if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "integer", "or", "returns", "None", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L234-L243
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_integer
def get_as_integer(self, key): """ Converts map element into an integer or returns 0 if conversion is not possible. :param key: an index of element to get. :return: integer value ot the element or 0 if conversion is not supported. """ value = self.get(key) retur...
python
def get_as_integer(self, key): """ Converts map element into an integer or returns 0 if conversion is not possible. :param key: an index of element to get. :return: integer value ot the element or 0 if conversion is not supported. """ value = self.get(key) retur...
[ "def", "get_as_integer", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "IntegerConverter", ".", "to_integer", "(", "value", ")" ]
Converts map element into an integer or returns 0 if conversion is not possible. :param key: an index of element to get. :return: integer value ot the element or 0 if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "integer", "or", "returns", "0", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L245-L254
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_integer_with_default
def get_as_integer_with_default(self, key, default_value): """ Converts map element into an integer or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: integer value ot the element or ...
python
def get_as_integer_with_default(self, key, default_value): """ Converts map element into an integer or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: integer value ot the element or ...
[ "def", "get_as_integer_with_default", "(", "self", ",", "key", ",", "default_value", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "IntegerConverter", ".", "to_integer_with_default", "(", "value", ",", "default_value", ")" ]
Converts map element into an integer or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: integer value ot the element or default value if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "integer", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L256-L267
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_nullable_float
def get_as_nullable_float(self, key): """ Converts map element into a float or returns None if conversion is not possible. :param key: an index of element to get. :return: float value of the element or None if conversion is not supported. """ value = self.get(key) ...
python
def get_as_nullable_float(self, key): """ Converts map element into a float or returns None if conversion is not possible. :param key: an index of element to get. :return: float value of the element or None if conversion is not supported. """ value = self.get(key) ...
[ "def", "get_as_nullable_float", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "FloatConverter", ".", "to_nullable_float", "(", "value", ")" ]
Converts map element into a float or returns None if conversion is not possible. :param key: an index of element to get. :return: float value of the element or None if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "float", "or", "returns", "None", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L281-L290
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_float
def get_as_float(self, key): """ Converts map element into a float or returns 0 if conversion is not possible. :param key: an index of element to get. :return: float value ot the element or 0 if conversion is not supported. """ value = self.get(key) return Float...
python
def get_as_float(self, key): """ Converts map element into a float or returns 0 if conversion is not possible. :param key: an index of element to get. :return: float value ot the element or 0 if conversion is not supported. """ value = self.get(key) return Float...
[ "def", "get_as_float", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "FloatConverter", ".", "to_float", "(", "value", ")" ]
Converts map element into a float or returns 0 if conversion is not possible. :param key: an index of element to get. :return: float value ot the element or 0 if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "float", "or", "returns", "0", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L292-L301
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_float_with_default
def get_as_float_with_default(self, key, default_value): """ Converts map element into a float or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: float value ot the element or default...
python
def get_as_float_with_default(self, key, default_value): """ Converts map element into a float or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: float value ot the element or default...
[ "def", "get_as_float_with_default", "(", "self", ",", "key", ",", "default_value", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "FloatConverter", ".", "to_float_with_default", "(", "value", ",", "default_value", ")" ]
Converts map element into a float or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: float value ot the element or default value if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "float", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L303-L314
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_nullable_datetime
def get_as_nullable_datetime(self, key): """ Converts map element into a Date or returns None if conversion is not possible. :param key: an index of element to get. :return: Date value of the element or None if conversion is not supported. """ value = self.get(key) ...
python
def get_as_nullable_datetime(self, key): """ Converts map element into a Date or returns None if conversion is not possible. :param key: an index of element to get. :return: Date value of the element or None if conversion is not supported. """ value = self.get(key) ...
[ "def", "get_as_nullable_datetime", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "DateTimeConverter", ".", "to_nullable_datetime", "(", "value", ")" ]
Converts map element into a Date or returns None if conversion is not possible. :param key: an index of element to get. :return: Date value of the element or None if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "Date", "or", "returns", "None", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L316-L325
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_datetime
def get_as_datetime(self, key): """ Converts map element into a Date or returns the current date if conversion is not possible. :param key: an index of element to get. :return: Date value ot the element or the current date if conversion is not supported. """ value = sel...
python
def get_as_datetime(self, key): """ Converts map element into a Date or returns the current date if conversion is not possible. :param key: an index of element to get. :return: Date value ot the element or the current date if conversion is not supported. """ value = sel...
[ "def", "get_as_datetime", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "DateTimeConverter", ".", "to_datetime", "(", "value", ")" ]
Converts map element into a Date or returns the current date if conversion is not possible. :param key: an index of element to get. :return: Date value ot the element or the current date if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "Date", "or", "returns", "the", "current", "date", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L327-L336
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_datetime_with_default
def get_as_datetime_with_default(self, key, default_value): """ Converts map element into a Date or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: Date value ot the element or defaul...
python
def get_as_datetime_with_default(self, key, default_value): """ Converts map element into a Date or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: Date value ot the element or defaul...
[ "def", "get_as_datetime_with_default", "(", "self", ",", "key", ",", "default_value", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "DateTimeConverter", ".", "to_datetime_with_default", "(", "value", ",", "default_value", ")" ]
Converts map element into a Date or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: Date value ot the element or default value if conversion is not supported.
[ "Converts", "map", "element", "into", "a", "Date", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L338-L349
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_nullable_type
def get_as_nullable_type(self, key, value_type): """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns None. :param key: an index of element to get. :param value_type: the TypeCode that defined the type of the result ...
python
def get_as_nullable_type(self, key, value_type): """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns None. :param key: an index of element to get. :param value_type: the TypeCode that defined the type of the result ...
[ "def", "get_as_nullable_type", "(", "self", ",", "key", ",", "value_type", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "TypeConverter", ".", "to_nullable_type", "(", "value_type", ",", "value", ")" ]
Converts map element into a value defined by specied typecode. If conversion is not possible it returns None. :param key: an index of element to get. :param value_type: the TypeCode that defined the type of the result :return: element value defined by the typecode or None if conversio...
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "None", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L351-L363
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_type
def get_as_type(self, key, value_type): """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. :param key: an index of element to get. :param value_type: the TypeCode that defined the typ...
python
def get_as_type(self, key, value_type): """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. :param key: an index of element to get. :param value_type: the TypeCode that defined the typ...
[ "def", "get_as_type", "(", "self", ",", "key", ",", "value_type", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "TypeConverter", ".", "to_type", "(", "value_type", ",", "value", ")" ]
Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. :param key: an index of element to get. :param value_type: the TypeCode that defined the type of the result :return: element value defined by t...
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "default", "value", "for", "the", "specified", "type", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L365-L377
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_type_with_default
def get_as_type_with_default(self, key, value_type, default_value): """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value. :param key: an index of element to get. :param value_type: the TypeCode that defined th...
python
def get_as_type_with_default(self, key, value_type, default_value): """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value. :param key: an index of element to get. :param value_type: the TypeCode that defined th...
[ "def", "get_as_type_with_default", "(", "self", ",", "key", ",", "value_type", ",", "default_value", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "TypeConverter", ".", "to_type_with_default", "(", "value_type", ",", "value", ",", "d...
Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value. :param key: an index of element to get. :param value_type: the TypeCode that defined the type of the result :param default_value: the default value :return: ...
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "default", "value", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L379-L393
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_array
def get_as_array(self, key): """ Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. :param key: an index of element to get. :return: AnyValueMap value of the element or empty AnyValueMap if conversion is not supported. """ ...
python
def get_as_array(self, key): """ Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. :param key: an index of element to get. :return: AnyValueMap value of the element or empty AnyValueMap if conversion is not supported. """ ...
[ "def", "get_as_array", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "AnyValueMap", ".", "from_value", "(", "value", ")" ]
Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. :param key: an index of element to get. :return: AnyValueMap value of the element or empty AnyValueMap if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "AnyValueMap", "or", "returns", "empty", "AnyValueMap", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L395-L404
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_nullable_map
def get_as_nullable_map(self, key): """ Converts map element into an AnyValueMap or returns None if conversion is not possible. :param key: a key of element to get. :return: AnyValueMap value of the element or None if conversion is not supported. """ value = self.get_as...
python
def get_as_nullable_map(self, key): """ Converts map element into an AnyValueMap or returns None if conversion is not possible. :param key: a key of element to get. :return: AnyValueMap value of the element or None if conversion is not supported. """ value = self.get_as...
[ "def", "get_as_nullable_map", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "get_as_object", "(", "key", ")", "return", "AnyValueMap", ".", "from_value", "(", "value", ")" ]
Converts map element into an AnyValueMap or returns None if conversion is not possible. :param key: a key of element to get. :return: AnyValueMap value of the element or None if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "AnyValueMap", "or", "returns", "None", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L406-L415
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_map_with_default
def get_as_map_with_default(self, key, default_value): """ Converts map element into an AnyValueMap or returns default value if conversion is not possible. :param key: a key of element to get. :param default_value: the default value :return: AnyValueMap value of the element or...
python
def get_as_map_with_default(self, key, default_value): """ Converts map element into an AnyValueMap or returns default value if conversion is not possible. :param key: a key of element to get. :param default_value: the default value :return: AnyValueMap value of the element or...
[ "def", "get_as_map_with_default", "(", "self", ",", "key", ",", "default_value", ")", ":", "value", "=", "self", ".", "get_as_nullable_map", "(", "key", ")", "return", "MapConverter", ".", "to_map_with_default", "(", "value", ",", "default_value", ")" ]
Converts map element into an AnyValueMap or returns default value if conversion is not possible. :param key: a key of element to get. :param default_value: the default value :return: AnyValueMap value of the element or default value if conversion is not supported.
[ "Converts", "map", "element", "into", "an", "AnyValueMap", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L421-L432
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.from_maps
def from_maps(*maps): """ Creates a new AnyValueMap by merging two or more maps. Maps defined later in the list override values from previously defined maps. :param maps: an array of maps to be merged :return: a newly created AnyValueMap. """ result = AnyValueMa...
python
def from_maps(*maps): """ Creates a new AnyValueMap by merging two or more maps. Maps defined later in the list override values from previously defined maps. :param maps: an array of maps to be merged :return: a newly created AnyValueMap. """ result = AnyValueMa...
[ "def", "from_maps", "(", "*", "maps", ")", ":", "result", "=", "AnyValueMap", "(", ")", "if", "maps", "==", "None", "or", "len", "(", "maps", ")", "==", "0", ":", "return", "result", "for", "map", "in", "maps", ":", "for", "(", "key", ",", "value...
Creates a new AnyValueMap by merging two or more maps. Maps defined later in the list override values from previously defined maps. :param maps: an array of maps to be merged :return: a newly created AnyValueMap.
[ "Creates", "a", "new", "AnyValueMap", "by", "merging", "two", "or", "more", "maps", ".", "Maps", "defined", "later", "in", "the", "list", "override", "values", "from", "previously", "defined", "maps", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L521-L540
borzecki/q
quicksearch/launch.py
open
def open(url): """ Launches browser depending on os """ if sys.platform == 'win32': os.startfile(url) elif sys.platform == 'darwin': subprocess.Popen(['open', url]) else: try: subprocess.Popen(['xdg-open', url]) except OSError: import webbrowser ...
python
def open(url): """ Launches browser depending on os """ if sys.platform == 'win32': os.startfile(url) elif sys.platform == 'darwin': subprocess.Popen(['open', url]) else: try: subprocess.Popen(['xdg-open', url]) except OSError: import webbrowser ...
[ "def", "open", "(", "url", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "os", ".", "startfile", "(", "url", ")", "elif", "sys", ".", "platform", "==", "'darwin'", ":", "subprocess", ".", "Popen", "(", "[", "'open'", ",", "url", "]"...
Launches browser depending on os
[ "Launches", "browser", "depending", "on", "os" ]
train
https://github.com/borzecki/q/blob/9d5c153fb12b353a73d6909599ad4b1e4e56304d/quicksearch/launch.py#L6-L17
siemens/django-dingos
dingos/core/decorators.py
print_arguments
def print_arguments(): """ Decorator that provides the wrapped function with an attribute 'print_arguments' containing just those keyword arguments actually passed in to the function. To use the decorator for debugging, preface the function into whose calls you are interested with '@print_arguments...
python
def print_arguments(): """ Decorator that provides the wrapped function with an attribute 'print_arguments' containing just those keyword arguments actually passed in to the function. To use the decorator for debugging, preface the function into whose calls you are interested with '@print_arguments...
[ "def", "print_arguments", "(", ")", ":", "def", "decorator", "(", "function", ")", ":", "def", "inner", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", ":", "print", "\"Passed arguments:\"", "for", "i", "in", "args", ":", "pp", "."...
Decorator that provides the wrapped function with an attribute 'print_arguments' containing just those keyword arguments actually passed in to the function. To use the decorator for debugging, preface the function into whose calls you are interested with '@print_arguments()'
[ "Decorator", "that", "provides", "the", "wrapped", "function", "with", "an", "attribute", "print_arguments", "containing", "just", "those", "keyword", "arguments", "actually", "passed", "in", "to", "the", "function", "." ]
train
https://github.com/siemens/django-dingos/blob/7154f75b06d2538568e2f2455a76f3d0db0b7d70/dingos/core/decorators.py#L23-L41
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxServiceRouter.set_subservice
def set_subservice(self, obj): """Add a sub-service object. :param obj: stackinabox.services.StackInABoxService instance :raises: RouteAlreadyRegisteredError if the route is already registered :returns: n/a """ # ensure there is not already a sub-service if self....
python
def set_subservice(self, obj): """Add a sub-service object. :param obj: stackinabox.services.StackInABoxService instance :raises: RouteAlreadyRegisteredError if the route is already registered :returns: n/a """ # ensure there is not already a sub-service if self....
[ "def", "set_subservice", "(", "self", ",", "obj", ")", ":", "# ensure there is not already a sub-service", "if", "self", ".", "obj", "is", "not", "None", ":", "raise", "RouteAlreadyRegisteredError", "(", "'Service Router ({0} - {1}): Route {2} already has a '", "'sub-servic...
Add a sub-service object. :param obj: stackinabox.services.StackInABoxService instance :raises: RouteAlreadyRegisteredError if the route is already registered :returns: n/a
[ "Add", "a", "sub", "-", "service", "object", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L66-L92
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxServiceRouter.update_uris
def update_uris(self, new_uri): """Update all URIS. :param new_uri: URI to switch to and update the matching :returns: n/a Note: This overwrites any existing URI """ self.uri = new_uri # if there is a sub-service, update it too if self.obj: ...
python
def update_uris(self, new_uri): """Update all URIS. :param new_uri: URI to switch to and update the matching :returns: n/a Note: This overwrites any existing URI """ self.uri = new_uri # if there is a sub-service, update it too if self.obj: ...
[ "def", "update_uris", "(", "self", ",", "new_uri", ")", ":", "self", ".", "uri", "=", "new_uri", "# if there is a sub-service, update it too", "if", "self", ".", "obj", ":", "self", ".", "obj", ".", "base_url", "=", "'{0}/{1}'", ".", "format", "(", "self", ...
Update all URIS. :param new_uri: URI to switch to and update the matching :returns: n/a Note: This overwrites any existing URI
[ "Update", "all", "URIS", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L94-L106
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxServiceRouter.register_method
def register_method(self, method, fn): """Register an HTTP method and handler function. :param method: string, HTTP verb :param fn: python function handling the request :raises: RouteAlreadyRegisteredError if the route is already registered :returns: n/a """ # e...
python
def register_method(self, method, fn): """Register an HTTP method and handler function. :param method: string, HTTP verb :param fn: python function handling the request :raises: RouteAlreadyRegisteredError if the route is already registered :returns: n/a """ # e...
[ "def", "register_method", "(", "self", ",", "method", ",", "fn", ")", ":", "# ensure the HTTP verb is not already registered", "if", "method", "not", "in", "self", ".", "methods", ".", "keys", "(", ")", ":", "logger", ".", "debug", "(", "'Service Router ({0} - {...
Register an HTTP method and handler function. :param method: string, HTTP verb :param fn: python function handling the request :raises: RouteAlreadyRegisteredError if the route is already registered :returns: n/a
[ "Register", "an", "HTTP", "method", "and", "handler", "function", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L108-L134
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxService.validate_regex
def validate_regex(regex, sub_service): """Is the regex valid for StackInABox routing? :param regex: Python regex object to match the URI :param sub_service: boolean for whether or not the regex is for a sub-service :raises: InvalidRouteRegexError if the reg...
python
def validate_regex(regex, sub_service): """Is the regex valid for StackInABox routing? :param regex: Python regex object to match the URI :param sub_service: boolean for whether or not the regex is for a sub-service :raises: InvalidRouteRegexError if the reg...
[ "def", "validate_regex", "(", "regex", ",", "sub_service", ")", ":", "# The regex generated by stackinabox starts with ^", "# and ends with $. Enforce that the provided regex does the same.", "if", "regex", ".", "pattern", ".", "startswith", "(", "'^'", ")", "is", "False", ...
Is the regex valid for StackInABox routing? :param regex: Python regex object to match the URI :param sub_service: boolean for whether or not the regex is for a sub-service :raises: InvalidRouteRegexError if the regex does not meet the requirements.
[ "Is", "the", "regex", "valid", "for", "StackInABox", "routing?" ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L237-L264
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxService.get_service_regex
def get_service_regex(base_url, service_url, sub_service): """Get the regex for a given service. :param base_url: string - Base URI :param service_url: string - Service URI under the Base URI :param sub_service: boolean - is the Service URI for a sub-service? :returns: Python R...
python
def get_service_regex(base_url, service_url, sub_service): """Get the regex for a given service. :param base_url: string - Base URI :param service_url: string - Service URI under the Base URI :param sub_service: boolean - is the Service URI for a sub-service? :returns: Python R...
[ "def", "get_service_regex", "(", "base_url", ",", "service_url", ",", "sub_service", ")", ":", "# if the specified service_url is already a regex", "# then just use. Otherwise create what we need", "if", "StackInABoxService", ".", "is_regex", "(", "service_url", ")", ":", "lo...
Get the regex for a given service. :param base_url: string - Base URI :param service_url: string - Service URI under the Base URI :param sub_service: boolean - is the Service URI for a sub-service? :returns: Python Regex object containing the regex for the Service
[ "Get", "the", "regex", "for", "a", "given", "service", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L267-L290
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxService.base_url
def base_url(self, value): """Set the Base URI value. :param value: the new URI to use for the Base URI """ logger.debug('StackInABoxService ({0}:{1}) Updating Base URL ' 'from {2} to {3}' .format(self.__id, self.nam...
python
def base_url(self, value): """Set the Base URI value. :param value: the new URI to use for the Base URI """ logger.debug('StackInABoxService ({0}:{1}) Updating Base URL ' 'from {2} to {3}' .format(self.__id, self.nam...
[ "def", "base_url", "(", "self", ",", "value", ")", ":", "logger", ".", "debug", "(", "'StackInABoxService ({0}:{1}) Updating Base URL '", "'from {2} to {3}'", ".", "format", "(", "self", ".", "__id", ",", "self", ".", "name", ",", "self", ".", "__base_url", ",...
Set the Base URI value. :param value: the new URI to use for the Base URI
[ "Set", "the", "Base", "URI", "value", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L298-L314
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxService.reset
def reset(self): """Reset the service to its' initial state.""" logger.debug('StackInABoxService ({0}): Reset' .format(self.__id, self.name)) self.base_url = '/{0}'.format(self.name) logger.debug('StackInABoxService ({0}): Hosting Service {1}' .f...
python
def reset(self): """Reset the service to its' initial state.""" logger.debug('StackInABoxService ({0}): Reset' .format(self.__id, self.name)) self.base_url = '/{0}'.format(self.name) logger.debug('StackInABoxService ({0}): Hosting Service {1}' .f...
[ "def", "reset", "(", "self", ")", ":", "logger", ".", "debug", "(", "'StackInABoxService ({0}): Reset'", ".", "format", "(", "self", ".", "__id", ",", "self", ".", "name", ")", ")", "self", ".", "base_url", "=", "'/{0}'", ".", "format", "(", "self", "....
Reset the service to its' initial state.
[ "Reset", "the", "service", "to", "its", "initial", "state", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L316-L322
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxService.try_handle_route
def try_handle_route(self, route_uri, method, request, uri, headers): """Try to handle the supplied request on the specified routing URI. :param route_uri: string - URI of the request :param method: string - HTTP Verb :param request: request object describing the HTTP request :p...
python
def try_handle_route(self, route_uri, method, request, uri, headers): """Try to handle the supplied request on the specified routing URI. :param route_uri: string - URI of the request :param method: string - HTTP Verb :param request: request object describing the HTTP request :p...
[ "def", "try_handle_route", "(", "self", ",", "route_uri", ",", "method", ",", "request", ",", "uri", ",", "headers", ")", ":", "uri_path", "=", "route_uri", "if", "'?'", "in", "uri", ":", "logger", ".", "debug", "(", "'StackInABoxService ({0}:{1}): Found query...
Try to handle the supplied request on the specified routing URI. :param route_uri: string - URI of the request :param method: string - HTTP Verb :param request: request object describing the HTTP request :param uri: URI of the reuqest :param headers: case-insensitive headers dic...
[ "Try", "to", "handle", "the", "supplied", "request", "on", "the", "specified", "routing", "URI", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L324-L366
TestInABox/stackInABox
stackinabox/services/service.py
StackInABoxService.sub_request
def sub_request(self, method, request, uri, headers): """Handle the supplied sub-service request on the specified routing URI. :param method: string - HTTP Verb :param request: request object describing the HTTP request :param uri: URI of the reuqest :param headers: case-insensi...
python
def sub_request(self, method, request, uri, headers): """Handle the supplied sub-service request on the specified routing URI. :param method: string - HTTP Verb :param request: request object describing the HTTP request :param uri: URI of the reuqest :param headers: case-insensi...
[ "def", "sub_request", "(", "self", ",", "method", ",", "request", ",", "uri", ",", "headers", ")", ":", "logger", ".", "debug", "(", "'StackInABoxService ({0}:{1}): Sub-Request Received '", "'{2} - {3}'", ".", "format", "(", "self", ".", "__id", ",", "self", "...
Handle the supplied sub-service request on the specified routing URI. :param method: string - HTTP Verb :param request: request object describing the HTTP request :param uri: URI of the reuqest :param headers: case-insensitive headers dict :returns: tuple - (int, dict, string) ...
[ "Handle", "the", "supplied", "sub", "-", "service", "request", "on", "the", "specified", "routing", "URI", "." ]
train
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L385-L401