hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
_hotkey_find_and_call
<not_specific>
def _hotkey_find_and_call( self, hotkey, hotkey_type, event, propagate=None ): """ Find hotkey and call hotkey function. :param hotkey: Hotkey's virtual key list. :param hotkey_type: Hotkey type. :param event: Event object. :param propagate: Whether propag...
Find hotkey and call hotkey function. :param hotkey: Hotkey's virtual key list. :param hotkey_type: Hotkey type. :param event: Event object. :param propagate: Whether propagate the event. :return: A two-item tuple. Tuple format is: ( Ite...
Find hotkey and call hotkey function.
[ "Find", "hotkey", "and", "call", "hotkey", "function", "." ]
def _hotkey_find_and_call( self, hotkey, hotkey_type, event, propagate=None ): hotkey_info = self._hotkey_info_get_by_hotkey( hotkey=hotkey, hotkey_type=hotkey_type ) if hotkey_info is None: return (False, propagate) propagate = self._hotkey_call( ...
[ "def", "_hotkey_find_and_call", "(", "self", ",", "hotkey", ",", "hotkey_type", ",", "event", ",", "propagate", "=", "None", ")", ":", "hotkey_info", "=", "self", ".", "_hotkey_info_get_by_hotkey", "(", "hotkey", "=", "hotkey", ",", "hotkey_type", "=", "hotkey...
Find hotkey and call hotkey function.
[ "Find", "hotkey", "and", "call", "hotkey", "function", "." ]
[ "\"\"\"\n Find hotkey and call hotkey function.\n\n :param hotkey: Hotkey's virtual key list.\n\n :param hotkey_type: Hotkey type.\n\n :param event: Event object.\n\n :param propagate: Whether propagate the event.\n\n :return: A two-item tuple.\n\n Tuple format is:\n...
[ { "param": "self", "type": null }, { "param": "hotkey", "type": null }, { "param": "hotkey_type", "type": null }, { "param": "event", "type": null }, { "param": "propagate", "type": null } ]
{ "returns": [ { "docstring": "A two-item tuple.\nTuple format is:\n(\nItem 0, # Whether hotkey is found.\nItem 1: # Whether propagate the event.", "docstring_tokens": [ "A", "two", "-", "item", "tuple", ".", "Tuple", "format", ...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
_hotkey_call
<not_specific>
def _hotkey_call( self, hotkey, hotkey_type, hotkey_info, event, propagate=None ): """ Call hotkey function, catching errors. :param hotkey: Hotkey's virtual key list. :param hotkey_type: Hotkey type. :param hotkey_info: Hotkey info. :param event: Event ob...
Call hotkey function, catching errors. :param hotkey: Hotkey's virtual key list. :param hotkey_type: Hotkey type. :param hotkey_info: Hotkey info. :param event: Event object. :param propagate: Whether propagate the event. :return: Whether propagate the even...
Call hotkey function, catching errors.
[ "Call", "hotkey", "function", "catching", "errors", "." ]
def _hotkey_call( self, hotkey, hotkey_type, hotkey_info, event, propagate=None ): if self._hotkey_tfunc is not None: try: self._hotkey_tfunc( self, hotkey, hotkey_type, hotkey_info, event ) except Exception: ...
[ "def", "_hotkey_call", "(", "self", ",", "hotkey", ",", "hotkey_type", ",", "hotkey_info", ",", "event", ",", "propagate", "=", "None", ")", ":", "if", "self", ".", "_hotkey_tfunc", "is", "not", "None", ":", "try", ":", "self", ".", "_hotkey_tfunc", "(",...
Call hotkey function, catching errors.
[ "Call", "hotkey", "function", "catching", "errors", "." ]
[ "\"\"\"\n Call hotkey function, catching errors.\n\n :param hotkey: Hotkey's virtual key list.\n\n :param hotkey_type: Hotkey type.\n\n :param hotkey_info: Hotkey info.\n\n :param event: Event object.\n\n :param propagate: Whether propagate the event.\n\n :return: Wh...
[ { "param": "self", "type": null }, { "param": "hotkey", "type": null }, { "param": "hotkey_type", "type": null }, { "param": "hotkey_info", "type": null }, { "param": "event", "type": null }, { "param": "propagate", "type": null } ]
{ "returns": [ { "docstring": "Whether propagate the event.", "docstring_tokens": [ "Whether", "propagate", "the", "event", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docs...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
_hotseq_find_and_call
<not_specific>
def _hotseq_find_and_call(self, vk, event, propagate=None): """ Find and call key-sequence function. :param vk: Current down event's virtual key. :param event: Event object. :param propagate: Whether propagate the event. :return: A two-item tuple. Tuple forma...
Find and call key-sequence function. :param vk: Current down event's virtual key. :param event: Event object. :param propagate: Whether propagate the event. :return: A two-item tuple. Tuple format is: ( Item 0, # Whether hot-sequence is found...
Find and call key-sequence function.
[ "Find", "and", "call", "key", "-", "sequence", "function", "." ]
def _hotseq_find_and_call(self, vk, event, propagate=None): hotseq_is_found = False if not self._hotkey_info_by_vk_map_for_key_seq: return (hotseq_is_found, propagate) self._vk_s_dn_queue.append(vk) hotseq_len_max = 0 for hotseq, hotkey_info in \ self....
[ "def", "_hotseq_find_and_call", "(", "self", ",", "vk", ",", "event", ",", "propagate", "=", "None", ")", ":", "hotseq_is_found", "=", "False", "if", "not", "self", ".", "_hotkey_info_by_vk_map_for_key_seq", ":", "return", "(", "hotseq_is_found", ",", "propagate...
Find and call key-sequence function.
[ "Find", "and", "call", "key", "-", "sequence", "function", "." ]
[ "\"\"\"\n Find and call key-sequence function.\n\n :param vk: Current down event's virtual key.\n\n :param event: Event object.\n\n :param propagate: Whether propagate the event.\n\n :return: A two-item tuple.\n\n Tuple format is:\n (\n Item 0, # Wheth...
[ { "param": "self", "type": null }, { "param": "vk", "type": null }, { "param": "event", "type": null }, { "param": "propagate", "type": null } ]
{ "returns": [ { "docstring": "A two-item tuple.\nTuple format is:\n(\nItem 0, # Whether hot-sequence is found.\nItem 1: # Whether propagate the event.", "docstring_tokens": [ "A", "two", "-", "item", "tuple", ".", "Tuple", "forma...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
_hotseq_is_triggered
<not_specific>
def _hotseq_is_triggered(self, hotseq): """ Test whether given key-sequence is triggered. :param hotseq: Key-sequence's virtual key list. :return: Whether given key-sequence is triggered. """ # Get given key-sequence's length hotseq_len = len(hotseq) # ...
Test whether given key-sequence is triggered. :param hotseq: Key-sequence's virtual key list. :return: Whether given key-sequence is triggered.
Test whether given key-sequence is triggered.
[ "Test", "whether", "given", "key", "-", "sequence", "is", "triggered", "." ]
def _hotseq_is_triggered(self, hotseq): hotseq_len = len(hotseq) try: for idx, vk in enumerate(hotseq): queue_idx = -hotseq_len + idx queue_vk = self._vk_s_dn_queue[queue_idx] if vk != queue_vk: return False except I...
[ "def", "_hotseq_is_triggered", "(", "self", ",", "hotseq", ")", ":", "hotseq_len", "=", "len", "(", "hotseq", ")", "try", ":", "for", "idx", ",", "vk", "in", "enumerate", "(", "hotseq", ")", ":", "queue_idx", "=", "-", "hotseq_len", "+", "idx", "queue_...
Test whether given key-sequence is triggered.
[ "Test", "whether", "given", "key", "-", "sequence", "is", "triggered", "." ]
[ "\"\"\"\n Test whether given key-sequence is triggered.\n\n :param hotseq: Key-sequence's virtual key list.\n\n :return: Whether given key-sequence is triggered.\n \"\"\"", "# Get given key-sequence's length", "# Compare with the newest virtual keys in the queue", "# For given key-...
[ { "param": "self", "type": null }, { "param": "hotseq", "type": null } ]
{ "returns": [ { "docstring": "Whether given key-sequence is triggered.", "docstring_tokens": [ "Whether", "given", "key", "-", "sequence", "is", "triggered", "." ], "type": null } ], "raises": [], "params": [ { ...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
_vk_down_add
null
def _vk_down_add(self, vk): """ Add given virtual key to currently down list. :param vk: Virtual key. :return: None. """ # Get virtual key info vk_info = (vk, time.time()) # Add virtual key info to currently down list self._vk_s_dn.append(vk_inf...
Add given virtual key to currently down list. :param vk: Virtual key. :return: None.
Add given virtual key to currently down list.
[ "Add", "given", "virtual", "key", "to", "currently", "down", "list", "." ]
def _vk_down_add(self, vk): vk_info = (vk, time.time()) self._vk_s_dn.append(vk_info)
[ "def", "_vk_down_add", "(", "self", ",", "vk", ")", ":", "vk_info", "=", "(", "vk", ",", "time", ".", "time", "(", ")", ")", "self", ".", "_vk_s_dn", ".", "append", "(", "vk_info", ")" ]
Add given virtual key to currently down list.
[ "Add", "given", "virtual", "key", "to", "currently", "down", "list", "." ]
[ "\"\"\"\n Add given virtual key to currently down list.\n\n :param vk: Virtual key.\n\n :return: None.\n \"\"\"", "# Get virtual key info", "# Add virtual key info to currently down list" ]
[ { "param": "self", "type": null }, { "param": "vk", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
_vk_down_remove
null
def _vk_down_remove(self, vk): """ Remove given virtual key from currently down list. :param vk: Virtual key. :return: None. """ # New virtual key down list new_down_list = [] # For each virtual key info in currently down list for vk_info in sel...
Remove given virtual key from currently down list. :param vk: Virtual key. :return: None.
Remove given virtual key from currently down list.
[ "Remove", "given", "virtual", "key", "from", "currently", "down", "list", "." ]
def _vk_down_remove(self, vk): new_down_list = [] for vk_info in self._vk_s_dn: if vk_info[0] != vk: new_down_list.append(vk_info) self._vk_s_dn = new_down_list
[ "def", "_vk_down_remove", "(", "self", ",", "vk", ")", ":", "new_down_list", "=", "[", "]", "for", "vk_info", "in", "self", ".", "_vk_s_dn", ":", "if", "vk_info", "[", "0", "]", "!=", "vk", ":", "new_down_list", ".", "append", "(", "vk_info", ")", "s...
Remove given virtual key from currently down list.
[ "Remove", "given", "virtual", "key", "from", "currently", "down", "list", "." ]
[ "\"\"\"\n Remove given virtual key from currently down list.\n\n :param vk: Virtual key.\n\n :return: None.\n \"\"\"", "# New virtual key down list", "# For each virtual key info in currently down list", "# If the virtual key is not given virtual key", "# Add the virtual key info...
[ { "param": "self", "type": null }, { "param": "vk", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
_vk_down_remove_outdated
null
def _vk_down_remove_outdated(self): """ Remove outdated virtual keys from currently down list. :return: None. """ # Get timestamp min value before which virtual keys are considered # outdated timestamp_min = time.time() - 1 # New virtual key down list ...
Remove outdated virtual keys from currently down list. :return: None.
Remove outdated virtual keys from currently down list.
[ "Remove", "outdated", "virtual", "keys", "from", "currently", "down", "list", "." ]
def _vk_down_remove_outdated(self): timestamp_min = time.time() - 1 new_down_list = [] for vk_info in self._vk_s_dn: if vk_info[1] > timestamp_min: new_down_list.append(vk_info) self._vk_s_dn = new_down_list
[ "def", "_vk_down_remove_outdated", "(", "self", ")", ":", "timestamp_min", "=", "time", ".", "time", "(", ")", "-", "1", "new_down_list", "=", "[", "]", "for", "vk_info", "in", "self", ".", "_vk_s_dn", ":", "if", "vk_info", "[", "1", "]", ">", "timesta...
Remove outdated virtual keys from currently down list.
[ "Remove", "outdated", "virtual", "keys", "from", "currently", "down", "list", "." ]
[ "\"\"\"\n Remove outdated virtual keys from currently down list.\n\n :return: None.\n \"\"\"", "# Get timestamp min value before which virtual keys are considered", "# outdated", "# New virtual key down list", "# For each virtual key info in currently down list", "# If the virtual key...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
vk_down_list
<not_specific>
def vk_down_list(self): """ Get currently down virtual key list. :return: Currently down virtual key list. """ # Return currently down virtual key list return [x[0] for x in self._vk_s_dn]
Get currently down virtual key list. :return: Currently down virtual key list.
Get currently down virtual key list.
[ "Get", "currently", "down", "virtual", "key", "list", "." ]
def vk_down_list(self): return [x[0] for x in self._vk_s_dn]
[ "def", "vk_down_list", "(", "self", ")", ":", "return", "[", "x", "[", "0", "]", "for", "x", "in", "self", ".", "_vk_s_dn", "]" ]
Get currently down virtual key list.
[ "Get", "currently", "down", "virtual", "key", "list", "." ]
[ "\"\"\"\n Get currently down virtual key list.\n\n :return: Currently down virtual key list.\n \"\"\"", "# Return currently down virtual key list" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Currently down virtual key list.", "docstring_tokens": [ "Currently", "down", "virtual", "key", "list", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type"...
243efde49da8872a88e98b43dbb9e75a52bcbcc6
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_manager.py
[ "MIT" ]
Python
vk_to_name
<not_specific>
def vk_to_name(self, vk): """ Convert virtual key to name. :param vk: Virtual key. :return: Virtual key's name. """ # Convert virtual key to name return self._vk_ctn(vk)
Convert virtual key to name. :param vk: Virtual key. :return: Virtual key's name.
Convert virtual key to name.
[ "Convert", "virtual", "key", "to", "name", "." ]
def vk_to_name(self, vk): return self._vk_ctn(vk)
[ "def", "vk_to_name", "(", "self", ",", "vk", ")", ":", "return", "self", ".", "_vk_ctn", "(", "vk", ")" ]
Convert virtual key to name.
[ "Convert", "virtual", "key", "to", "name", "." ]
[ "\"\"\"\n Convert virtual key to name.\n\n :param vk: Virtual key.\n\n :return: Virtual key's name.\n \"\"\"", "# Convert virtual key to name" ]
[ { "param": "self", "type": null }, { "param": "vk", "type": null } ]
{ "returns": [ { "docstring": "Virtual key's name.", "docstring_tokens": [ "Virtual", "key", "'", "s", "name", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring...
5304c4ee115a9be6da624f0d30404e5f440295b8
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/sendkey_winos.py
[ "MIT" ]
Python
vk_to_sc
<not_specific>
def vk_to_sc(vk, flags=0): """ Map virtual key to scan code and flags. :param vk: Virtual key. :param flags: Flags. :return: A tuple of (scan_code, flags). """ # Map virtual key to scan code sc = _MapVirtualKeyW(vk, 0) # If the virtual key is extended key if (vk >= 33 and vk ...
Map virtual key to scan code and flags. :param vk: Virtual key. :param flags: Flags. :return: A tuple of (scan_code, flags).
Map virtual key to scan code and flags.
[ "Map", "virtual", "key", "to", "scan", "code", "and", "flags", "." ]
def vk_to_sc(vk, flags=0): sc = _MapVirtualKeyW(vk, 0) if (vk >= 33 and vk <= 46) or (vk >= 91 and vk <= 93): flags |= _KEYEVENTF_EXTENDEDKEY return sc, flags
[ "def", "vk_to_sc", "(", "vk", ",", "flags", "=", "0", ")", ":", "sc", "=", "_MapVirtualKeyW", "(", "vk", ",", "0", ")", "if", "(", "vk", ">=", "33", "and", "vk", "<=", "46", ")", "or", "(", "vk", ">=", "91", "and", "vk", "<=", "93", ")", ":...
Map virtual key to scan code and flags.
[ "Map", "virtual", "key", "to", "scan", "code", "and", "flags", "." ]
[ "\"\"\"\n Map virtual key to scan code and flags.\n\n :param vk: Virtual key.\n\n :param flags: Flags.\n\n :return: A tuple of (scan_code, flags).\n \"\"\"", "# Map virtual key to scan code", "# If the virtual key is extended key", "# Add extended key flag", "# Return the scan code and flags"...
[ { "param": "vk", "type": null }, { "param": "flags", "type": null } ]
{ "returns": [ { "docstring": "A tuple of (scan_code, flags).", "docstring_tokens": [ "A", "tuple", "of", "(", "scan_code", "flags", ")", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "...
5304c4ee115a9be6da624f0d30404e5f440295b8
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/sendkey_winos.py
[ "MIT" ]
Python
key_dn_sc
null
def key_dn_sc(vk): """ Send key-down event using scan code. :param vk: Virtual key. :return: None. """ # Map virtual key to scan code and flags scan, flags = vk_to_sc(vk, flags=_KEYEVENTF_SCANCODE) # Send key-down event key_dn(scan=scan, flags=flags)
Send key-down event using scan code. :param vk: Virtual key. :return: None.
Send key-down event using scan code.
[ "Send", "key", "-", "down", "event", "using", "scan", "code", "." ]
def key_dn_sc(vk): scan, flags = vk_to_sc(vk, flags=_KEYEVENTF_SCANCODE) key_dn(scan=scan, flags=flags)
[ "def", "key_dn_sc", "(", "vk", ")", ":", "scan", ",", "flags", "=", "vk_to_sc", "(", "vk", ",", "flags", "=", "_KEYEVENTF_SCANCODE", ")", "key_dn", "(", "scan", "=", "scan", ",", "flags", "=", "flags", ")" ]
Send key-down event using scan code.
[ "Send", "key", "-", "down", "event", "using", "scan", "code", "." ]
[ "\"\"\"\n Send key-down event using scan code.\n\n :param vk: Virtual key.\n\n :return: None.\n \"\"\"", "# Map virtual key to scan code and flags", "# Send key-down event" ]
[ { "param": "vk", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "vk", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "i...
5304c4ee115a9be6da624f0d30404e5f440295b8
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/sendkey_winos.py
[ "MIT" ]
Python
key_up_sc
null
def key_up_sc(vk): """ Send key-up event using scan code. :param vk: Virtual key. :return: None. """ # Map virtual key to scan code and flags scan, flags = vk_to_sc(vk, flags=_KEYEVENTF_SCANCODE) # Send key-up event key_up(scan=scan, flags=flags)
Send key-up event using scan code. :param vk: Virtual key. :return: None.
Send key-up event using scan code.
[ "Send", "key", "-", "up", "event", "using", "scan", "code", "." ]
def key_up_sc(vk): scan, flags = vk_to_sc(vk, flags=_KEYEVENTF_SCANCODE) key_up(scan=scan, flags=flags)
[ "def", "key_up_sc", "(", "vk", ")", ":", "scan", ",", "flags", "=", "vk_to_sc", "(", "vk", ",", "flags", "=", "_KEYEVENTF_SCANCODE", ")", "key_up", "(", "scan", "=", "scan", ",", "flags", "=", "flags", ")" ]
Send key-up event using scan code.
[ "Send", "key", "-", "up", "event", "using", "scan", "code", "." ]
[ "\"\"\"\n Send key-up event using scan code.\n\n :param vk: Virtual key.\n\n :return: None.\n \"\"\"", "# Map virtual key to scan code and flags", "# Send key-up event" ]
[ { "param": "vk", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "vk", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "i...
5304c4ee115a9be6da624f0d30404e5f440295b8
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/sendkey_winos.py
[ "MIT" ]
Python
_list_diff
<not_specific>
def _list_diff(a, b): """ Get the difference between two lists. :param a: The first list. :param b: The second list. :return: A list of items that are in the first list but not in the second \ list. """ # Return the difference between two lists return [x for x in a if x not in...
Get the difference between two lists. :param a: The first list. :param b: The second list. :return: A list of items that are in the first list but not in the second \ list.
Get the difference between two lists.
[ "Get", "the", "difference", "between", "two", "lists", "." ]
def _list_diff(a, b): return [x for x in a if x not in b]
[ "def", "_list_diff", "(", "a", ",", "b", ")", ":", "return", "[", "x", "for", "x", "in", "a", "if", "x", "not", "in", "b", "]" ]
Get the difference between two lists.
[ "Get", "the", "difference", "between", "two", "lists", "." ]
[ "\"\"\"\n Get the difference between two lists.\n\n :param a: The first list.\n\n :param b: The second list.\n\n :return: A list of items that are in the first list but not in the second \\\n list.\n \"\"\"", "# Return the difference between two lists" ]
[ { "param": "a", "type": null }, { "param": "b", "type": null } ]
{ "returns": [ { "docstring": "A list of items that are in the first list but not in the second \\\nlist.", "docstring_tokens": [ "A", "list", "of", "items", "that", "are", "in", "the", "first", "list", "but", ...
5304c4ee115a9be6da624f0d30404e5f440295b8
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/sendkey_winos.py
[ "MIT" ]
Python
keys_stroke
null
def keys_stroke( vks, vks_pressed=[], key_duration=None, key_interval=None, modifier_interval=None, release_initial_keys=True, restore_initial_modifiers=True, ): """ Send keys, without being interfered by previously pressed modifier keys. :param vks: Virtual keys to send. :...
Send keys, without being interfered by previously pressed modifier keys. :param vks: Virtual keys to send. :param vks_pressed: Virtual keys that are currently pressed. :param key_duration: Duration between sending key-down and key-up events \ for a non-modifier key. :param key_interval:...
Send keys, without being interfered by previously pressed modifier keys.
[ "Send", "keys", "without", "being", "interfered", "by", "previously", "pressed", "modifier", "keys", "." ]
def keys_stroke( vks, vks_pressed=[], key_duration=None, key_interval=None, modifier_interval=None, release_initial_keys=True, restore_initial_modifiers=True, ): last_vk_is_modifier = True group_s = [] modifier_s = [] non_modifier_s = [] vk_idx = 0 vks_len = len(vks) ...
[ "def", "keys_stroke", "(", "vks", ",", "vks_pressed", "=", "[", "]", ",", "key_duration", "=", "None", ",", "key_interval", "=", "None", ",", "modifier_interval", "=", "None", ",", "release_initial_keys", "=", "True", ",", "restore_initial_modifiers", "=", "Tr...
Send keys, without being interfered by previously pressed modifier keys.
[ "Send", "keys", "without", "being", "interfered", "by", "previously", "pressed", "modifier", "keys", "." ]
[ "\"\"\"\n Send keys, without being interfered by previously pressed modifier keys.\n\n :param vks: Virtual keys to send.\n\n :param vks_pressed: Virtual keys that are currently pressed.\n\n :param key_duration: Duration between sending key-down and key-up events \\\n for a non-modifier key.\n\n ...
[ { "param": "vks", "type": null }, { "param": "vks_pressed", "type": null }, { "param": "key_duration", "type": null }, { "param": "key_interval", "type": null }, { "param": "modifier_interval", "type": null }, { "param": "release_initial_keys", "ty...
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "vks", "type": null, "docstring": "Virtual keys to send.", "docstring_tokens": [ "Virtual", "keys", ...
f94279533fba259ab85b6719683c871ea040f0bc
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/__main__.py
[ "MIT" ]
Python
check_deps
<not_specific>
def check_deps(): """ Check whether dependency packages have been installed. :return: Error message for missing dependency, otherwise None. """ # If the platform is MacOS if sys.platform.startswith('darwin'): try: # Import dependency module import AppKit ...
Check whether dependency packages have been installed. :return: Error message for missing dependency, otherwise None.
Check whether dependency packages have been installed.
[ "Check", "whether", "dependency", "packages", "have", "been", "installed", "." ]
def check_deps(): if sys.platform.startswith('darwin'): try: import AppKit id(AppKit) except ImportError: msg = ( 'Error: Package `pyobjc` is not installed. Try:\n' 'pip install pyobjc\n' ) return msg if ...
[ "def", "check_deps", "(", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "'darwin'", ")", ":", "try", ":", "import", "AppKit", "id", "(", "AppKit", ")", "except", "ImportError", ":", "msg", "=", "(", "'Error: Package `pyobjc` is not installe...
Check whether dependency packages have been installed.
[ "Check", "whether", "dependency", "packages", "have", "been", "installed", "." ]
[ "\"\"\"\n Check whether dependency packages have been installed.\n\n :return: Error message for missing dependency, otherwise None.\n \"\"\"", "# If the platform is MacOS", "# Import dependency module", "# Suppress linter error", "# If the dependency module is not found", "# Get error message", ...
[]
{ "returns": [ { "docstring": "Error message for missing dependency, otherwise None.", "docstring_tokens": [ "Error", "message", "for", "missing", "dependency", "otherwise", "None", "." ], "type": null } ], "raises": [...
f94279533fba259ab85b6719683c871ea040f0bc
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/__main__.py
[ "MIT" ]
Python
main
<not_specific>
def main(args=None): """ Main function that is the program entry point. This function does three things: - Prepares `sys.path` so that program users do not need set up PYTHONPATH. - Checks whether dependency packages have been installed. - Delegates call to :paramref:`aoikhotkey.mediator.mai...
Main function that is the program entry point. This function does three things: - Prepares `sys.path` so that program users do not need set up PYTHONPATH. - Checks whether dependency packages have been installed. - Delegates call to :paramref:`aoikhotkey.mediator.main_wrap`. :param args: A...
Main function that is the program entry point. This function does three things. Prepares `sys.path` so that program users do not need set up PYTHONPATH. Checks whether dependency packages have been installed.
[ "Main", "function", "that", "is", "the", "program", "entry", "point", ".", "This", "function", "does", "three", "things", ".", "Prepares", "`", "sys", ".", "path", "`", "so", "that", "program", "users", "do", "not", "need", "set", "up", "PYTHONPATH", "."...
def main(args=None): syspath_init() print('----- sys.path -----') print('\n'.join(sys.path)) print('===== sys.path =====') error_msg = check_deps() if error_msg is not None: sys.stderr.write(error_msg) return 8 from aoikhotkey.mediator import main_wrap return main_wrap(ar...
[ "def", "main", "(", "args", "=", "None", ")", ":", "syspath_init", "(", ")", "print", "(", "'----- sys.path -----'", ")", "print", "(", "'\\n'", ".", "join", "(", "sys", ".", "path", ")", ")", "print", "(", "'===== sys.path ====='", ")", "error_msg", "="...
Main function that is the program entry point.
[ "Main", "function", "that", "is", "the", "program", "entry", "point", "." ]
[ "\"\"\"\n Main function that is the program entry point.\n\n This function does three things:\n\n - Prepares `sys.path` so that program users do not need set up PYTHONPATH.\n\n - Checks whether dependency packages have been installed.\n\n - Delegates call to :paramref:`aoikhotkey.mediator.main_wrap`....
[ { "param": "args", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Argument list. Default is use `sys.argv[1:]`.", "docstring_tokens": [ "A...
dfb08fc2e60952a089dc2705edd3a14a028e9370
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/mediator.py
[ "MIT" ]
Python
sys_use_decide
<not_specific>
def sys_use_decide(uri, mod_uri_s_reloaded): """ Decide whether use existing module or reload module for given URI. :param uri: Object URI. :param mod_uri_s_reloaded: List of module URIs that have been reloaded. :return: Whether use existing module. """ # Get m...
Decide whether use existing module or reload module for given URI. :param uri: Object URI. :param mod_uri_s_reloaded: List of module URIs that have been reloaded. :return: Whether use existing module.
Decide whether use existing module or reload module for given URI.
[ "Decide", "whether", "use", "existing", "module", "or", "reload", "module", "for", "given", "URI", "." ]
def sys_use_decide(uri, mod_uri_s_reloaded): _, mod_uri, _ = uri_split(uri) if mod_uri.startswith('aoikhotkey.'): sys_use = True elif mod_uri in mod_uri_s_reloaded: sys_use = True else: sys_use = False mod_uri_s_reloaded.append(mod_uri) ...
[ "def", "sys_use_decide", "(", "uri", ",", "mod_uri_s_reloaded", ")", ":", "_", ",", "mod_uri", ",", "_", "=", "uri_split", "(", "uri", ")", "if", "mod_uri", ".", "startswith", "(", "'aoikhotkey.'", ")", ":", "sys_use", "=", "True", "elif", "mod_uri", "in...
Decide whether use existing module or reload module for given URI.
[ "Decide", "whether", "use", "existing", "module", "or", "reload", "module", "for", "given", "URI", "." ]
[ "\"\"\"\n Decide whether use existing module or reload module for given URI.\n\n :param uri: Object URI.\n\n :param mod_uri_s_reloaded: List of module URIs that have been reloaded.\n\n :return: Whether use existing module.\n \"\"\"", "# Get module URI from given object URI", "...
[ { "param": "uri", "type": null }, { "param": "mod_uri_s_reloaded", "type": null } ]
{ "returns": [ { "docstring": "Whether use existing module.", "docstring_tokens": [ "Whether", "use", "existing", "module", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "uri", "type": null, "docst...
dfb08fc2e60952a089dc2705edd3a14a028e9370
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/mediator.py
[ "MIT" ]
Python
main_wrap
<not_specific>
def main_wrap(args=None): """ Main function's wrapper function. :param args: Argument list. Default is use `sys.argv[1:]`. :return: Exit code. """ try: # Delegate call to `main_inner` return main_inner(args) # If have `SystemExit` except SystemExit: # Raise as-...
Main function's wrapper function. :param args: Argument list. Default is use `sys.argv[1:]`. :return: Exit code.
Main function's wrapper function.
[ "Main", "function", "'", "s", "wrapper", "function", "." ]
def main_wrap(args=None): try: return main_inner(args) except SystemExit: raise except KeyboardInterrupt: return MAIN_RET_V_OK except BaseException: tb_msg = format_exc() sys.stderr.write('# Caught exception\n---\n{0}---\n'.format(tb_msg)) return MAIN_RET_...
[ "def", "main_wrap", "(", "args", "=", "None", ")", ":", "try", ":", "return", "main_inner", "(", "args", ")", "except", "SystemExit", ":", "raise", "except", "KeyboardInterrupt", ":", "return", "MAIN_RET_V_OK", "except", "BaseException", ":", "tb_msg", "=", ...
Main function's wrapper function.
[ "Main", "function", "'", "s", "wrapper", "function", "." ]
[ "\"\"\"\n Main function's wrapper function.\n\n :param args: Argument list. Default is use `sys.argv[1:]`.\n\n :return: Exit code.\n \"\"\"", "# Delegate call to `main_inner`", "# If have `SystemExit`", "# Raise as-is", "# If have `KeyboardInterrupt`", "# Return exit code", "# If have other ...
[ { "param": "args", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Argument list. Default is use `sys.argv[1:]`.", "docstring_tokens": [ "A...
e7473583a9ab9a596a36e0bf6b673ef152306edd
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_parser.py
[ "MIT" ]
Python
_map_name_to_win_vk
<not_specific>
def _map_name_to_win_vk(name): """ Map given name to Windows virtual key. :param name: Name. :return: Windows virtual key, or None if not found. """ # Map custom name to Windows virtual key. # Custom name is mapped first for `^`, `#`, `!`, `+` to mean modifier keys. vk = _MAP_CUSTOM_NA...
Map given name to Windows virtual key. :param name: Name. :return: Windows virtual key, or None if not found.
Map given name to Windows virtual key.
[ "Map", "given", "name", "to", "Windows", "virtual", "key", "." ]
def _map_name_to_win_vk(name): vk = _MAP_CUSTOM_NAME_TO_WIN_VK.get(name.upper(), None) if vk is not None: return vk vk = MAP_CHAR_TO_WIN_VK.get(name, None) if vk is not None: return vk vk = MAP_SHIFTED_CHAR_TO_WIN_VK.get(name, None) if vk is not None: vk_s = [EVK_SHIFT, v...
[ "def", "_map_name_to_win_vk", "(", "name", ")", ":", "vk", "=", "_MAP_CUSTOM_NAME_TO_WIN_VK", ".", "get", "(", "name", ".", "upper", "(", ")", ",", "None", ")", "if", "vk", "is", "not", "None", ":", "return", "vk", "vk", "=", "MAP_CHAR_TO_WIN_VK", ".", ...
Map given name to Windows virtual key.
[ "Map", "given", "name", "to", "Windows", "virtual", "key", "." ]
[ "\"\"\"\n Map given name to Windows virtual key.\n\n :param name: Name.\n\n :return: Windows virtual key, or None if not found.\n \"\"\"", "# Map custom name to Windows virtual key.", "# Custom name is mapped first for `^`, `#`, `!`, `+` to mean modifier keys.", "# If virtual key is found", "# R...
[ { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "Windows virtual key, or None if not found.", "docstring_tokens": [ "Windows", "virtual", "key", "or", "None", "if", "not", "found", "." ], "type": null } ], "raises": [], "param...
e7473583a9ab9a596a36e0bf6b673ef152306edd
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_parser.py
[ "MIT" ]
Python
vk_ntc
<not_specific>
def vk_ntc(name): """ Map given name to virtual key. :param name: Name. :return: Virtual key, or None if not found. """ # If the platform is MacOS if IS_MACOS: # Map standard name or short name to MacOS virtual key mac_vk = _MAP_NAME_SHORT_NAME_TO_MAC_VK.get(name.upper(), N...
Map given name to virtual key. :param name: Name. :return: Virtual key, or None if not found.
Map given name to virtual key.
[ "Map", "given", "name", "to", "virtual", "key", "." ]
def vk_ntc(name): if IS_MACOS: mac_vk = _MAP_NAME_SHORT_NAME_TO_MAC_VK.get(name.upper(), None) if mac_vk is not None: return mac_vk win_vk = _map_name_to_win_vk(name) if win_vk is not None: if IS_MACOS: if win_vk < 1000: vk = MAP_WIN_VK_TO_MAC_...
[ "def", "vk_ntc", "(", "name", ")", ":", "if", "IS_MACOS", ":", "mac_vk", "=", "_MAP_NAME_SHORT_NAME_TO_MAC_VK", ".", "get", "(", "name", ".", "upper", "(", ")", ",", "None", ")", "if", "mac_vk", "is", "not", "None", ":", "return", "mac_vk", "win_vk", "...
Map given name to virtual key.
[ "Map", "given", "name", "to", "virtual", "key", "." ]
[ "\"\"\"\n Map given name to virtual key.\n\n :param name: Name.\n\n :return: Virtual key, or None if not found.\n \"\"\"", "# If the platform is MacOS", "# Map standard name or short name to MacOS virtual key", "# If virtual key is found", "# Return the virtual key", "# Map standard name or sh...
[ { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "Virtual key, or None if not found.", "docstring_tokens": [ "Virtual", "key", "or", "None", "if", "not", "found", "." ], "type": null } ], "raises": [], "params": [ { "identifi...
e7473583a9ab9a596a36e0bf6b673ef152306edd
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_parser.py
[ "MIT" ]
Python
vk_ctn
<not_specific>
def vk_ctn(vk): """ Map given virtual key to name. :param vk: Virtual key. :return: Virtual key's name, or None if not found. """ # If the platform is MacOS if IS_MACOS: # Map given virtual key to name. # May be None. return _MAP_MAC_VK_TO_CUSTOM_NAME.get(vk, None) ...
Map given virtual key to name. :param vk: Virtual key. :return: Virtual key's name, or None if not found.
Map given virtual key to name.
[ "Map", "given", "virtual", "key", "to", "name", "." ]
def vk_ctn(vk): if IS_MACOS: return _MAP_MAC_VK_TO_CUSTOM_NAME.get(vk, None) else: return _MAP_WIN_VK_TO_CUSTOM_NAME.get(vk, None)
[ "def", "vk_ctn", "(", "vk", ")", ":", "if", "IS_MACOS", ":", "return", "_MAP_MAC_VK_TO_CUSTOM_NAME", ".", "get", "(", "vk", ",", "None", ")", "else", ":", "return", "_MAP_WIN_VK_TO_CUSTOM_NAME", ".", "get", "(", "vk", ",", "None", ")" ]
Map given virtual key to name.
[ "Map", "given", "virtual", "key", "to", "name", "." ]
[ "\"\"\"\n Map given virtual key to name.\n\n :param vk: Virtual key.\n\n :return: Virtual key's name, or None if not found.\n \"\"\"", "# If the platform is MacOS", "# Map given virtual key to name.", "# May be None.", "# If the platform is not MacOS.", "# Map given virtual key to name.", "#...
[ { "param": "vk", "type": null } ]
{ "returns": [ { "docstring": "Virtual key's name, or None if not found.", "docstring_tokens": [ "Virtual", "key", "'", "s", "name", "or", "None", "if", "not", "found", "." ], "type": null } ], ...
e7473583a9ab9a596a36e0bf6b673ef152306edd
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_parser.py
[ "MIT" ]
Python
vk_expand
<not_specific>
def vk_expand(vk): """ Expand given virtual key to a tuple containing two sided virtual keys. :param vk: Virtual key. :return: A tuple containing two sided virtual keys, or None if given \ virtual key can not be expanded. """ # If the platform is MacOS if IS_MACOS: # Expand...
Expand given virtual key to a tuple containing two sided virtual keys. :param vk: Virtual key. :return: A tuple containing two sided virtual keys, or None if given \ virtual key can not be expanded.
Expand given virtual key to a tuple containing two sided virtual keys.
[ "Expand", "given", "virtual", "key", "to", "a", "tuple", "containing", "two", "sided", "virtual", "keys", "." ]
def vk_expand(vk): if IS_MACOS: return _MAP_VK_TO_SIDED_MAC_VK_TUPLE.get(vk, None) else: return _MAP_VK_TO_SIDED_WIN_VK_TUPLE.get(vk, None)
[ "def", "vk_expand", "(", "vk", ")", ":", "if", "IS_MACOS", ":", "return", "_MAP_VK_TO_SIDED_MAC_VK_TUPLE", ".", "get", "(", "vk", ",", "None", ")", "else", ":", "return", "_MAP_VK_TO_SIDED_WIN_VK_TUPLE", ".", "get", "(", "vk", ",", "None", ")" ]
Expand given virtual key to a tuple containing two sided virtual keys.
[ "Expand", "given", "virtual", "key", "to", "a", "tuple", "containing", "two", "sided", "virtual", "keys", "." ]
[ "\"\"\"\n Expand given virtual key to a tuple containing two sided virtual keys.\n\n :param vk: Virtual key.\n\n :return: A tuple containing two sided virtual keys, or None if given \\\n virtual key can not be expanded.\n \"\"\"", "# If the platform is MacOS", "# Expand given virtual key", ...
[ { "param": "vk", "type": null } ]
{ "returns": [ { "docstring": "A tuple containing two sided virtual keys, or None if given \\\nvirtual key can not be expanded.", "docstring_tokens": [ "A", "tuple", "containing", "two", "sided", "virtual", "keys", "or", "None", ...
e7473583a9ab9a596a36e0bf6b673ef152306edd
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_parser.py
[ "MIT" ]
Python
vk_tran
<not_specific>
def vk_tran(vk, side=VK_TRAN_SIDE_V_LEFT): """ Transform given virtual key to sided virtual key. """ # If given side is not valid if side not in { VK_TRAN_SIDE_V_NONE, VK_TRAN_SIDE_V_LEFT, VK_TRAN_SIDE_V_RIGHT, }: # Raise error raise ValueError(side) ...
Transform given virtual key to sided virtual key.
Transform given virtual key to sided virtual key.
[ "Transform", "given", "virtual", "key", "to", "sided", "virtual", "key", "." ]
def vk_tran(vk, side=VK_TRAN_SIDE_V_LEFT): if side not in { VK_TRAN_SIDE_V_NONE, VK_TRAN_SIDE_V_LEFT, VK_TRAN_SIDE_V_RIGHT, }: raise ValueError(side) if side == VK_TRAN_SIDE_V_NONE: return vk vk_s = vk_expand(vk) if vk_s is None: return vk Code `v...
[ "def", "vk_tran", "(", "vk", ",", "side", "=", "VK_TRAN_SIDE_V_LEFT", ")", ":", "if", "side", "not", "in", "{", "VK_TRAN_SIDE_V_NONE", ",", "VK_TRAN_SIDE_V_LEFT", ",", "VK_TRAN_SIDE_V_RIGHT", ",", "}", ":", "raise", "ValueError", "(", "side", ")", "if", "sid...
Transform given virtual key to sided virtual key.
[ "Transform", "given", "virtual", "key", "to", "sided", "virtual", "key", "." ]
[ "\"\"\"\n Transform given virtual key to sided virtual key.\n \"\"\"", "# If given side is not valid", "# Raise error", "# If given side is valid.", "# If given side is none", "# Return given virtual key", "# If given side is not none.", "# Expand given virtual key to two sided virtual keys", ...
[ { "param": "vk", "type": null }, { "param": "side", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vk", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "side", "type": null, "docstring": null, "docstring_tokens": [],...
e7473583a9ab9a596a36e0bf6b673ef152306edd
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_parser.py
[ "MIT" ]
Python
hotkey_parse_inner
<not_specific>
def hotkey_parse_inner(pattern, vk_ntc, vk_tran, vk_expand): """ Hotkey parse function's inner function. :param pattern: Hotkey pattern. :param vk_ntc: Name to virtual key function. :param vk_tran: Virtual key transform function. :param vk_expand: Virtual key expand function. :return: H...
Hotkey parse function's inner function. :param pattern: Hotkey pattern. :param vk_ntc: Name to virtual key function. :param vk_tran: Virtual key transform function. :param vk_expand: Virtual key expand function. :return: Hotkey list. Each hotkey is a virtual key list.
Hotkey parse function's inner function.
[ "Hotkey", "parse", "function", "'", "s", "inner", "function", "." ]
def hotkey_parse_inner(pattern, vk_ntc, vk_tran, vk_expand): vk_s = [] pattern_len = len(pattern) idx = 0 last_is_left = False last_is_right = False while idx < pattern_len: char = pattern[idx] idx += 1 is_left = False is_right = False vk = None if...
[ "def", "hotkey_parse_inner", "(", "pattern", ",", "vk_ntc", ",", "vk_tran", ",", "vk_expand", ")", ":", "vk_s", "=", "[", "]", "pattern_len", "=", "len", "(", "pattern", ")", "idx", "=", "0", "last_is_left", "=", "False", "last_is_right", "=", "False", "...
Hotkey parse function's inner function.
[ "Hotkey", "parse", "function", "'", "s", "inner", "function", "." ]
[ "\"\"\"\n Hotkey parse function's inner function.\n\n :param pattern: Hotkey pattern.\n\n :param vk_ntc: Name to virtual key function.\n\n :param vk_tran: Virtual key transform function.\n\n :param vk_expand: Virtual key expand function.\n\n :return: Hotkey list. Each hotkey is a virtual key list....
[ { "param": "pattern", "type": null }, { "param": "vk_ntc", "type": null }, { "param": "vk_tran", "type": null }, { "param": "vk_expand", "type": null } ]
{ "returns": [ { "docstring": "Hotkey list. Each hotkey is a virtual key list.", "docstring_tokens": [ "Hotkey", "list", ".", "Each", "hotkey", "is", "a", "virtual", "key", "list", "." ], "type": null ...
e7473583a9ab9a596a36e0bf6b673ef152306edd
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/hotkey_parser.py
[ "MIT" ]
Python
_hotkey_expand
<not_specific>
def _hotkey_expand(hotkey, vk_expand): """ Expand given virtual key list to multiple virtual key lists. Expansion is needed because some virtual keys are one-to-many. E.g. [CTRL, A] -> [[LCTRL, A], [RCTRL, A]] :param hotkey: Virtual key list. :param vk_expand: Virtual key expand function. ...
Expand given virtual key list to multiple virtual key lists. Expansion is needed because some virtual keys are one-to-many. E.g. [CTRL, A] -> [[LCTRL, A], [RCTRL, A]] :param hotkey: Virtual key list. :param vk_expand: Virtual key expand function. :return: A list of virtual key lists.
Expand given virtual key list to multiple virtual key lists. Expansion is needed because some virtual keys are one-to-many.
[ "Expand", "given", "virtual", "key", "list", "to", "multiple", "virtual", "key", "lists", ".", "Expansion", "is", "needed", "because", "some", "virtual", "keys", "are", "one", "-", "to", "-", "many", "." ]
def _hotkey_expand(hotkey, vk_expand): hotkey_s = [[]] for vk in hotkey: exp_vk_s = vk_expand(vk) if (exp_vk_s is None) or (exp_vk_s is vk): exp_vk_s = [vk] else: exp_vk_s = exp_vk_s new_hotkey_s = [] for exp_vk in exp_vk_s: for old_hot...
[ "def", "_hotkey_expand", "(", "hotkey", ",", "vk_expand", ")", ":", "hotkey_s", "=", "[", "[", "]", "]", "for", "vk", "in", "hotkey", ":", "exp_vk_s", "=", "vk_expand", "(", "vk", ")", "if", "(", "exp_vk_s", "is", "None", ")", "or", "(", "exp_vk_s", ...
Expand given virtual key list to multiple virtual key lists.
[ "Expand", "given", "virtual", "key", "list", "to", "multiple", "virtual", "key", "lists", "." ]
[ "\"\"\"\n Expand given virtual key list to multiple virtual key lists.\n\n Expansion is needed because some virtual keys are one-to-many.\n E.g. [CTRL, A] -> [[LCTRL, A], [RCTRL, A]]\n\n :param hotkey: Virtual key list.\n\n :param vk_expand: Virtual key expand function.\n\n :return: A list of virt...
[ { "param": "hotkey", "type": null }, { "param": "vk_expand", "type": null } ]
{ "returns": [ { "docstring": "A list of virtual key lists.", "docstring_tokens": [ "A", "list", "of", "virtual", "key", "lists", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "hotkey", "...
dded2ede156aed5712b7fe594f2ac58c453d2f36
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/efunc.py
[ "MIT" ]
Python
efunc
null
def efunc(event): """ Event function that prints all events. :param event: Event object. :return: None. """ # Get hotkey manager hotkey_manager = hotkey_manager_get() # If given event is mouse event if 'mouse' in event.MessageName: # Get virtual key from `Message` field ...
Event function that prints all events. :param event: Event object. :return: None.
Event function that prints all events.
[ "Event", "function", "that", "prints", "all", "events", "." ]
def efunc(event): hotkey_manager = hotkey_manager_get() if 'mouse' in event.MessageName: vk = event.Message else: vk = event.KeyID if 'mouse wheel' in event.MessageName: wheel_up = event.Wheel > 0 wheel_side = 'up' if wheel_up else 'down' else: wheel_side = No...
[ "def", "efunc", "(", "event", ")", ":", "hotkey_manager", "=", "hotkey_manager_get", "(", ")", "if", "'mouse'", "in", "event", ".", "MessageName", ":", "vk", "=", "event", ".", "Message", "else", ":", "vk", "=", "event", ".", "KeyID", "if", "'mouse wheel...
Event function that prints all events.
[ "Event", "function", "that", "prints", "all", "events", "." ]
[ "\"\"\"\n Event function that prints all events.\n\n :param event: Event object.\n\n :return: None.\n \"\"\"", "# Get hotkey manager", "# If given event is mouse event", "# Get virtual key from `Message` field", "# If given event is not mouse event", "# Get virtual key from `KeyID` field", "...
[ { "param": "event", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "event", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
dded2ede156aed5712b7fe594f2ac58c453d2f36
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/efunc.py
[ "MIT" ]
Python
efunc_no_mouse
<not_specific>
def efunc_no_mouse(event): """ Event function that prints all but mouse events. :param event: Event object. :return: None. """ # If given event is mouse event if 'mouse' in event.MessageName: # Return return # If given event is not mouse event else: # Deleg...
Event function that prints all but mouse events. :param event: Event object. :return: None.
Event function that prints all but mouse events.
[ "Event", "function", "that", "prints", "all", "but", "mouse", "events", "." ]
def efunc_no_mouse(event): if 'mouse' in event.MessageName: return else: return efunc(event)
[ "def", "efunc_no_mouse", "(", "event", ")", ":", "if", "'mouse'", "in", "event", ".", "MessageName", ":", "return", "else", ":", "return", "efunc", "(", "event", ")" ]
Event function that prints all but mouse events.
[ "Event", "function", "that", "prints", "all", "but", "mouse", "events", "." ]
[ "\"\"\"\n Event function that prints all but mouse events.\n\n :param event: Event object.\n\n :return: None.\n \"\"\"", "# If given event is mouse event", "# Return", "# If given event is not mouse event", "# Delegate call to `efunc`" ]
[ { "param": "event", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "event", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
dded2ede156aed5712b7fe594f2ac58c453d2f36
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/util/efunc.py
[ "MIT" ]
Python
efunc_no_mouse_move
<not_specific>
def efunc_no_mouse_move(event): """ Event function that prints all but mouse move events. :param event: Event object. :return: None. """ # If given event is mouse move event if 'mouse' in event.MessageName and event.Message == VK_MOUSE_MOVE: # Return return # If given ...
Event function that prints all but mouse move events. :param event: Event object. :return: None.
Event function that prints all but mouse move events.
[ "Event", "function", "that", "prints", "all", "but", "mouse", "move", "events", "." ]
def efunc_no_mouse_move(event): if 'mouse' in event.MessageName and event.Message == VK_MOUSE_MOVE: return else: return efunc(event)
[ "def", "efunc_no_mouse_move", "(", "event", ")", ":", "if", "'mouse'", "in", "event", ".", "MessageName", "and", "event", ".", "Message", "==", "VK_MOUSE_MOVE", ":", "return", "else", ":", "return", "efunc", "(", "event", ")" ]
Event function that prints all but mouse move events.
[ "Event", "function", "that", "prints", "all", "but", "mouse", "move", "events", "." ]
[ "\"\"\"\n Event function that prints all but mouse move events.\n\n :param event: Event object.\n\n :return: None.\n \"\"\"", "# If given event is mouse move event", "# Return", "# If given event is not mouse move event", "# Delegate call to `efunc`" ]
[ { "param": "event", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "event", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
04ca216c698c678f837772f6243ef341df14a9ff
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/task_manager.py
[ "MIT" ]
Python
add_task
null
def add_task(self, func): """ Add task function to be run in the task manager's thread pool. :param func: Task function. :return: None. """ # Create wrapper function def func_wrapper(): try: # Call given function func(...
Add task function to be run in the task manager's thread pool. :param func: Task function. :return: None.
Add task function to be run in the task manager's thread pool.
[ "Add", "task", "function", "to", "be", "run", "in", "the", "task", "manager", "'", "s", "thread", "pool", "." ]
def add_task(self, func): def func_wrapper(): try: func() except BaseException: tb_msg = format_exc() msg = ( '# Error calling function in task thread:\n' '---\n{0}---\n' ).format(tb_m...
[ "def", "add_task", "(", "self", ",", "func", ")", ":", "def", "func_wrapper", "(", ")", ":", "try", ":", "func", "(", ")", "except", "BaseException", ":", "tb_msg", "=", "format_exc", "(", ")", "msg", "=", "(", "'# Error calling function in task thread:\\n'"...
Add task function to be run in the task manager's thread pool.
[ "Add", "task", "function", "to", "be", "run", "in", "the", "task", "manager", "'", "s", "thread", "pool", "." ]
[ "\"\"\"\n Add task function to be run in the task manager's thread pool.\n\n :param func: Task function.\n\n :return: None.\n \"\"\"", "# Create wrapper function", "# Call given function", "# If have error", "# Get traceback message", "# Get error message", "# Print error mes...
[ { "param": "self", "type": null }, { "param": "func", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
04ca216c698c678f837772f6243ef341df14a9ff
AoiKuiyuyou/AoikHotkey
src/aoikhotkey/task_manager.py
[ "MIT" ]
Python
add_task
null
def add_task(func): """ Add task function to be run in the task manager's thread pool. :param func: Task function. :return: None. """ # Add task function to be run in the task manager's thread pool _TASK_MANAGER.add_task(func)
Add task function to be run in the task manager's thread pool. :param func: Task function. :return: None.
Add task function to be run in the task manager's thread pool.
[ "Add", "task", "function", "to", "be", "run", "in", "the", "task", "manager", "'", "s", "thread", "pool", "." ]
def add_task(func): _TASK_MANAGER.add_task(func)
[ "def", "add_task", "(", "func", ")", ":", "_TASK_MANAGER", ".", "add_task", "(", "func", ")" ]
Add task function to be run in the task manager's thread pool.
[ "Add", "task", "function", "to", "be", "run", "in", "the", "task", "manager", "'", "s", "thread", "pool", "." ]
[ "\"\"\"\n Add task function to be run in the task manager's thread pool.\n\n :param func: Task function.\n\n :return: None.\n \"\"\"", "# Add task function to be run in the task manager's thread pool" ]
[ { "param": "func", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "func", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
838df797abc2f7780a00e93927875c4fc9aeddbb
EightMedia/django-precompressed
precompressed/storage/base.py
[ "MIT" ]
Python
should_skip_processing
<not_specific>
def should_skip_processing(self, source_storage, path, gzipped_name): """ return True if the specified file should not be processed. for example, because the processed version already exists and is up to date. """ if self.exists(gzipped_name): try: ...
return True if the specified file should not be processed. for example, because the processed version already exists and is up to date.
return True if the specified file should not be processed. for example, because the processed version already exists and is up to date.
[ "return", "True", "if", "the", "specified", "file", "should", "not", "be", "processed", ".", "for", "example", "because", "the", "processed", "version", "already", "exists", "and", "is", "up", "to", "date", "." ]
def should_skip_processing(self, source_storage, path, gzipped_name): if self.exists(gzipped_name): try: target_last_modified = self.modified_time(gzipped_name) source_last_modified = source_storage.modified_time(path) if target_last_modified >= source...
[ "def", "should_skip_processing", "(", "self", ",", "source_storage", ",", "path", ",", "gzipped_name", ")", ":", "if", "self", ".", "exists", "(", "gzipped_name", ")", ":", "try", ":", "target_last_modified", "=", "self", ".", "modified_time", "(", "gzipped_na...
return True if the specified file should not be processed.
[ "return", "True", "if", "the", "specified", "file", "should", "not", "be", "processed", "." ]
[ "\"\"\"\n return True if the specified file should not be processed.\n for example, because the processed version already exists\n and is up to date.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "source_storage", "type": null }, { "param": "path", "type": null }, { "param": "gzipped_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "source_storage", "type": null, "docstring": null, "docstring_...
838df797abc2f7780a00e93927875c4fc9aeddbb
EightMedia/django-precompressed
precompressed/storage/base.py
[ "MIT" ]
Python
pre_save_gzipped
<not_specific>
def pre_save_gzipped(self, name, gzipped_name, pregzipped_file): """ pre_save_gzipped is a hook to allow subclasses to alter the pregzipped file's content. """ return pregzipped_file
pre_save_gzipped is a hook to allow subclasses to alter the pregzipped file's content.
pre_save_gzipped is a hook to allow subclasses to alter the pregzipped file's content.
[ "pre_save_gzipped", "is", "a", "hook", "to", "allow", "subclasses", "to", "alter", "the", "pregzipped", "file", "'", "s", "content", "." ]
def pre_save_gzipped(self, name, gzipped_name, pregzipped_file): return pregzipped_file
[ "def", "pre_save_gzipped", "(", "self", ",", "name", ",", "gzipped_name", ",", "pregzipped_file", ")", ":", "return", "pregzipped_file" ]
pre_save_gzipped is a hook to allow subclasses to alter the pregzipped file's content.
[ "pre_save_gzipped", "is", "a", "hook", "to", "allow", "subclasses", "to", "alter", "the", "pregzipped", "file", "'", "s", "content", "." ]
[ "\"\"\"\n pre_save_gzipped is a hook to allow subclasses to\n alter the pregzipped file's content.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "gzipped_name", "type": null }, { "param": "pregzipped_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
838df797abc2f7780a00e93927875c4fc9aeddbb
EightMedia/django-precompressed
precompressed/storage/base.py
[ "MIT" ]
Python
compresslevel
<not_specific>
def compresslevel(self, name, gzipped_name, pregzipped_file): """ returns the compresslevel for a specified file 0 is no compression 1 is the fastest and produces the least compression 9 is the slowest and produces the most compression """ return utils.DEFAULT_...
returns the compresslevel for a specified file 0 is no compression 1 is the fastest and produces the least compression 9 is the slowest and produces the most compression
returns the compresslevel for a specified file 0 is no compression 1 is the fastest and produces the least compression 9 is the slowest and produces the most compression
[ "returns", "the", "compresslevel", "for", "a", "specified", "file", "0", "is", "no", "compression", "1", "is", "the", "fastest", "and", "produces", "the", "least", "compression", "9", "is", "the", "slowest", "and", "produces", "the", "most", "compression" ]
def compresslevel(self, name, gzipped_name, pregzipped_file): return utils.DEFAULT_COMPRESS_LEVEL
[ "def", "compresslevel", "(", "self", ",", "name", ",", "gzipped_name", ",", "pregzipped_file", ")", ":", "return", "utils", ".", "DEFAULT_COMPRESS_LEVEL" ]
returns the compresslevel for a specified file 0 is no compression 1 is the fastest and produces the least compression 9 is the slowest and produces the most compression
[ "returns", "the", "compresslevel", "for", "a", "specified", "file", "0", "is", "no", "compression", "1", "is", "the", "fastest", "and", "produces", "the", "least", "compression", "9", "is", "the", "slowest", "and", "produces", "the", "most", "compression" ]
[ "\"\"\"\n returns the compresslevel for a specified file\n 0 is no compression\n 1 is the fastest and produces the least compression\n 9 is the slowest and produces the most compression\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "gzipped_name", "type": null }, { "param": "pregzipped_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
838df797abc2f7780a00e93927875c4fc9aeddbb
EightMedia/django-precompressed
precompressed/storage/base.py
[ "MIT" ]
Python
gzipped_file
<not_specific>
def gzipped_file(self, name, gzipped_name, pregzipped_file): """ gzipped_file returns the gzipped version of the specified file. """ gzip_buffer = StringIO() gzipped_file = GzipFile( mode='wb', compresslevel=self.compresslevel( name, gzi...
gzipped_file returns the gzipped version of the specified file.
gzipped_file returns the gzipped version of the specified file.
[ "gzipped_file", "returns", "the", "gzipped", "version", "of", "the", "specified", "file", "." ]
def gzipped_file(self, name, gzipped_name, pregzipped_file): gzip_buffer = StringIO() gzipped_file = GzipFile( mode='wb', compresslevel=self.compresslevel( name, gzipped_name, pregzipped_file, ), fileobj=gzip_buffer, ) gzipp...
[ "def", "gzipped_file", "(", "self", ",", "name", ",", "gzipped_name", ",", "pregzipped_file", ")", ":", "gzip_buffer", "=", "StringIO", "(", ")", "gzipped_file", "=", "GzipFile", "(", "mode", "=", "'wb'", ",", "compresslevel", "=", "self", ".", "compressleve...
gzipped_file returns the gzipped version of the specified file.
[ "gzipped_file", "returns", "the", "gzipped", "version", "of", "the", "specified", "file", "." ]
[ "\"\"\"\n gzipped_file returns the gzipped version of the specified file.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "gzipped_name", "type": null }, { "param": "pregzipped_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
838df797abc2f7780a00e93927875c4fc9aeddbb
EightMedia/django-precompressed
precompressed/storage/base.py
[ "MIT" ]
Python
post_save_gzipped
null
def post_save_gzipped(self, name, gzipped_name, gzipped_file): """ post_save_gzipped is a hook to allow subclasses to cleanup/further process a gzipped file after it is saved """ pass
post_save_gzipped is a hook to allow subclasses to cleanup/further process a gzipped file after it is saved
post_save_gzipped is a hook to allow subclasses to cleanup/further process a gzipped file after it is saved
[ "post_save_gzipped", "is", "a", "hook", "to", "allow", "subclasses", "to", "cleanup", "/", "further", "process", "a", "gzipped", "file", "after", "it", "is", "saved" ]
def post_save_gzipped(self, name, gzipped_name, gzipped_file): pass
[ "def", "post_save_gzipped", "(", "self", ",", "name", ",", "gzipped_name", ",", "gzipped_file", ")", ":", "pass" ]
post_save_gzipped is a hook to allow subclasses to cleanup/further process a gzipped file after it is saved
[ "post_save_gzipped", "is", "a", "hook", "to", "allow", "subclasses", "to", "cleanup", "/", "further", "process", "a", "gzipped", "file", "after", "it", "is", "saved" ]
[ "\"\"\"\n post_save_gzipped is a hook to allow subclasses to\n cleanup/further process a gzipped file after it is saved\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "gzipped_name", "type": null }, { "param": "gzipped_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
838df797abc2f7780a00e93927875c4fc9aeddbb
EightMedia/django-precompressed
precompressed/storage/base.py
[ "MIT" ]
Python
post_process
<not_specific>
def post_process(self, paths, dry_run=False, **options): """ Post process the given list of files (called from collectstatic). Processing finds paths that match the configuration, gzips them and copies them to the target storage with the name generated by utils.get_gzipped_name...
Post process the given list of files (called from collectstatic). Processing finds paths that match the configuration, gzips them and copies them to the target storage with the name generated by utils.get_gzipped_name.
Post process the given list of files (called from collectstatic). Processing finds paths that match the configuration, gzips them and copies them to the target storage with the name generated by utils.get_gzipped_name.
[ "Post", "process", "the", "given", "list", "of", "files", "(", "called", "from", "collectstatic", ")", ".", "Processing", "finds", "paths", "that", "match", "the", "configuration", "gzips", "them", "and", "copies", "them", "to", "the", "target", "storage", "...
def post_process(self, paths, dry_run=False, **options): if hasattr(super(SaveGzippedCopyMixin, self), 'post_process'): processor = super(SaveGzippedCopyMixin, self).post_process( paths=paths.copy(), dry_run=dry_run, options=options, ) for original_path, proce...
[ "def", "post_process", "(", "self", ",", "paths", ",", "dry_run", "=", "False", ",", "**", "options", ")", ":", "if", "hasattr", "(", "super", "(", "SaveGzippedCopyMixin", ",", "self", ")", ",", "'post_process'", ")", ":", "processor", "=", "super", "(",...
Post process the given list of files (called from collectstatic).
[ "Post", "process", "the", "given", "list", "of", "files", "(", "called", "from", "collectstatic", ")", "." ]
[ "\"\"\"\n Post process the given list of files (called from collectstatic).\n\n Processing finds paths that match the configuration,\n gzips them and copies them to the target storage with\n the name generated by utils.get_gzipped_name.\n\n \"\"\"", "# allow other processors to ...
[ { "param": "self", "type": null }, { "param": "paths", "type": null }, { "param": "dry_run", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "paths", "type": null, "docstring": null, "docstring_tokens": ...
3f245d47559106ed5a490feefb3940d0c2c2e484
EightMedia/django-precompressed
precompressed/storage/s3boto.py
[ "MIT" ]
Python
pre_save_gzipped
<not_specific>
def pre_save_gzipped(self, name, gzipped_name, pregzipped_file): """ S3BotoStorage doesn't allow per file headers, so we will temporarily overwrite the default headers to set the correct Content-Encoding. """ self.set_s3boto_headers() return super(SaveGzippedC...
S3BotoStorage doesn't allow per file headers, so we will temporarily overwrite the default headers to set the correct Content-Encoding.
S3BotoStorage doesn't allow per file headers, so we will temporarily overwrite the default headers to set the correct Content-Encoding.
[ "S3BotoStorage", "doesn", "'", "t", "allow", "per", "file", "headers", "so", "we", "will", "temporarily", "overwrite", "the", "default", "headers", "to", "set", "the", "correct", "Content", "-", "Encoding", "." ]
def pre_save_gzipped(self, name, gzipped_name, pregzipped_file): self.set_s3boto_headers() return super(SaveGzippedCopyS3BotoMixin, self).pre_save_gzipped( name, gzipped_name, pregzipped_file, )
[ "def", "pre_save_gzipped", "(", "self", ",", "name", ",", "gzipped_name", ",", "pregzipped_file", ")", ":", "self", ".", "set_s3boto_headers", "(", ")", "return", "super", "(", "SaveGzippedCopyS3BotoMixin", ",", "self", ")", ".", "pre_save_gzipped", "(", "name",...
S3BotoStorage doesn't allow per file headers, so we will temporarily overwrite the default headers to set the correct Content-Encoding.
[ "S3BotoStorage", "doesn", "'", "t", "allow", "per", "file", "headers", "so", "we", "will", "temporarily", "overwrite", "the", "default", "headers", "to", "set", "the", "correct", "Content", "-", "Encoding", "." ]
[ "\"\"\"\n S3BotoStorage doesn't allow per file headers, so we will\n temporarily overwrite the default headers to\n set the correct Content-Encoding.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "gzipped_name", "type": null }, { "param": "pregzipped_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
3f245d47559106ed5a490feefb3940d0c2c2e484
EightMedia/django-precompressed
precompressed/storage/s3boto.py
[ "MIT" ]
Python
post_save_gzipped
<not_specific>
def post_save_gzipped(self, name, gzipped_name, gzipped_file): """ S3BotoStorage doesn't allow per file headers, so we need to restore the default headers that we overwrote before we saved the gzipped file. """ self.unset_s3boto_headers() return super(SaveGzip...
S3BotoStorage doesn't allow per file headers, so we need to restore the default headers that we overwrote before we saved the gzipped file.
S3BotoStorage doesn't allow per file headers, so we need to restore the default headers that we overwrote before we saved the gzipped file.
[ "S3BotoStorage", "doesn", "'", "t", "allow", "per", "file", "headers", "so", "we", "need", "to", "restore", "the", "default", "headers", "that", "we", "overwrote", "before", "we", "saved", "the", "gzipped", "file", "." ]
def post_save_gzipped(self, name, gzipped_name, gzipped_file): self.unset_s3boto_headers() return super(SaveGzippedCopyS3BotoMixin, self).post_save_gzipped( name, gzipped_name, gzipped_file, )
[ "def", "post_save_gzipped", "(", "self", ",", "name", ",", "gzipped_name", ",", "gzipped_file", ")", ":", "self", ".", "unset_s3boto_headers", "(", ")", "return", "super", "(", "SaveGzippedCopyS3BotoMixin", ",", "self", ")", ".", "post_save_gzipped", "(", "name"...
S3BotoStorage doesn't allow per file headers, so we need to restore the default headers that we overwrote before we saved the gzipped file.
[ "S3BotoStorage", "doesn", "'", "t", "allow", "per", "file", "headers", "so", "we", "need", "to", "restore", "the", "default", "headers", "that", "we", "overwrote", "before", "we", "saved", "the", "gzipped", "file", "." ]
[ "\"\"\"\n S3BotoStorage doesn't allow per file headers, so we\n need to restore the default headers that we overwrote\n before we saved the gzipped file.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "gzipped_name", "type": null }, { "param": "gzipped_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
765b090c6d703577c02d6a134231c1e74dabf208
EightMedia/django-precompressed
precompressed/utils.py
[ "MIT" ]
Python
accepts_gzip
<not_specific>
def accepts_gzip(request): """ returns True if the request accepts Content-Encoding: gzip """ return 'gzip' in request.META.get('HTTP_ACCEPT_ENCODING', '')
returns True if the request accepts Content-Encoding: gzip
returns True if the request accepts Content-Encoding: gzip
[ "returns", "True", "if", "the", "request", "accepts", "Content", "-", "Encoding", ":", "gzip" ]
def accepts_gzip(request): return 'gzip' in request.META.get('HTTP_ACCEPT_ENCODING', '')
[ "def", "accepts_gzip", "(", "request", ")", ":", "return", "'gzip'", "in", "request", ".", "META", ".", "get", "(", "'HTTP_ACCEPT_ENCODING'", ",", "''", ")" ]
returns True if the request accepts Content-Encoding: gzip
[ "returns", "True", "if", "the", "request", "accepts", "Content", "-", "Encoding", ":", "gzip" ]
[ "\"\"\"\n returns True if the request accepts Content-Encoding: gzip\n\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
765b090c6d703577c02d6a134231c1e74dabf208
EightMedia/django-precompressed
precompressed/utils.py
[ "MIT" ]
Python
should_save_gzipped_copy
<not_specific>
def should_save_gzipped_copy(path): """ returns True if the file specified by path should also have a copy gzipped and saved as get_gzipped_name(path) """ return matches_patterns(path, GZIP_PATTERNS)
returns True if the file specified by path should also have a copy gzipped and saved as get_gzipped_name(path)
returns True if the file specified by path should also have a copy gzipped and saved as get_gzipped_name(path)
[ "returns", "True", "if", "the", "file", "specified", "by", "path", "should", "also", "have", "a", "copy", "gzipped", "and", "saved", "as", "get_gzipped_name", "(", "path", ")" ]
def should_save_gzipped_copy(path): return matches_patterns(path, GZIP_PATTERNS)
[ "def", "should_save_gzipped_copy", "(", "path", ")", ":", "return", "matches_patterns", "(", "path", ",", "GZIP_PATTERNS", ")" ]
returns True if the file specified by path should also have a copy gzipped and saved as get_gzipped_name(path)
[ "returns", "True", "if", "the", "file", "specified", "by", "path", "should", "also", "have", "a", "copy", "gzipped", "and", "saved", "as", "get_gzipped_name", "(", "path", ")" ]
[ "\"\"\"\n returns True if the file specified by path should\n also have a copy gzipped and saved as get_gzipped_name(path)\n\n \"\"\"" ]
[ { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b50e4ff7686cf0dbd4629ae146083491535bb7be
EightMedia/django-precompressed
precompressed/context_processors.py
[ "MIT" ]
Python
accepts_gzip
<not_specific>
def accepts_gzip(request): """ defines ACCEPTS_GZIP -- a boolean which reflects whether the request accepts Content-Type: gzip. """ return {'ACCEPTS_GZIP': utils.accepts_gzip(request)}
defines ACCEPTS_GZIP -- a boolean which reflects whether the request accepts Content-Type: gzip.
defines ACCEPTS_GZIP -- a boolean which reflects whether the request accepts Content-Type: gzip.
[ "defines", "ACCEPTS_GZIP", "--", "a", "boolean", "which", "reflects", "whether", "the", "request", "accepts", "Content", "-", "Type", ":", "gzip", "." ]
def accepts_gzip(request): return {'ACCEPTS_GZIP': utils.accepts_gzip(request)}
[ "def", "accepts_gzip", "(", "request", ")", ":", "return", "{", "'ACCEPTS_GZIP'", ":", "utils", ".", "accepts_gzip", "(", "request", ")", "}" ]
defines ACCEPTS_GZIP -- a boolean which reflects whether the request accepts Content-Type: gzip.
[ "defines", "ACCEPTS_GZIP", "--", "a", "boolean", "which", "reflects", "whether", "the", "request", "accepts", "Content", "-", "Type", ":", "gzip", "." ]
[ "\"\"\"\n defines ACCEPTS_GZIP -- a boolean which reflects whether\n the request accepts Content-Type: gzip.\n\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2aa9867c83c5d9afd9a7010175fa6c4d9829e09b
hoaaoh/Audio2Vec
src/data_parser.py
[ "Apache-2.0" ]
Python
build_label_color_list
<not_specific>
def build_label_color_list(target_list, color_list): ''' assume the targets are in pairs ''' word_color_dict = {} for i, target in enumerate(target_list): word_color_dict[target] = color_list[i%len(color_list)] return word_color_dict
assume the targets are in pairs
assume the targets are in pairs
[ "assume", "the", "targets", "are", "in", "pairs" ]
def build_label_color_list(target_list, color_list): word_color_dict = {} for i, target in enumerate(target_list): word_color_dict[target] = color_list[i%len(color_list)] return word_color_dict
[ "def", "build_label_color_list", "(", "target_list", ",", "color_list", ")", ":", "word_color_dict", "=", "{", "}", "for", "i", ",", "target", "in", "enumerate", "(", "target_list", ")", ":", "word_color_dict", "[", "target", "]", "=", "color_list", "[", "i"...
assume the targets are in pairs
[ "assume", "the", "targets", "are", "in", "pairs" ]
[ "''' assume the targets are in pairs \n\n\n '''" ]
[ { "param": "target_list", "type": null }, { "param": "color_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "target_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "color_list", "type": null, "docstring": null, "docstri...
3631e3b7bc70f5f6beb699862f98061333ceffec
hoaaoh/Audio2Vec
src/audio2vec_train.py
[ "Apache-2.0" ]
Python
dataQ_feeding
<not_specific>
def dataQ_feeding(filename_queue, feat_dim, seq_len): """ Reads and parse the examples from alignment dataset Args: filename_queue: A queue of strings with the filenames to read from. Returns: An object representing a single example, with the following fields: MFCC sequence: 200 * 39 d...
Reads and parse the examples from alignment dataset Args: filename_queue: A queue of strings with the filenames to read from. Returns: An object representing a single example, with the following fields: MFCC sequence: 200 * 39 dimensions
Reads and parse the examples from alignment dataset
[ "Reads", "and", "parse", "the", "examples", "from", "alignment", "dataset" ]
def dataQ_feeding(filename_queue, feat_dim, seq_len): class MFCCRECORD(object): pass result = MFCCRECORD() reader = tf.TextLineReader() key, value = reader.read(filename_queue) record_defaults = [[1.] for i in range(feat_dim*seq_len)] tmp_result = tf.decode_csv(value, record_defaults=re...
[ "def", "dataQ_feeding", "(", "filename_queue", ",", "feat_dim", ",", "seq_len", ")", ":", "class", "MFCCRECORD", "(", "object", ")", ":", "pass", "result", "=", "MFCCRECORD", "(", ")", "reader", "=", "tf", ".", "TextLineReader", "(", ")", "key", ",", "va...
Reads and parse the examples from alignment dataset
[ "Reads", "and", "parse", "the", "examples", "from", "alignment", "dataset" ]
[ "\"\"\" Reads and parse the examples from alignment dataset \n Args:\n filename_queue: A queue of strings with the filenames to read from.\n\n Returns:\n An object representing a single example, with the following fields:\n MFCC sequence: 200 * 39 dimensions \n \n \"\"\"", "### us...
[ { "param": "filename_queue", "type": null }, { "param": "feat_dim", "type": null }, { "param": "seq_len", "type": null } ]
{ "returns": [ { "docstring": "An object representing a single example, with the following fields:\nMFCC sequence: 200 * 39 dimensions", "docstring_tokens": [ "An", "object", "representing", "a", "single", "example", "with", "the", ...
3631e3b7bc70f5f6beb699862f98061333ceffec
hoaaoh/Audio2Vec
src/audio2vec_train.py
[ "Apache-2.0" ]
Python
TFRQ_feeding
<not_specific>
def TFRQ_feeding(filename_queue, feat_dim, seq_len): """ Reads and parse the examples from alignment dataset in TF record format Args: filename_queue: A queue of strings with the filenames to read from feat_dim : feature dimension seq_len : sequence length (padded) Returns: ...
Reads and parse the examples from alignment dataset in TF record format Args: filename_queue: A queue of strings with the filenames to read from feat_dim : feature dimension seq_len : sequence length (padded) Returns: An object representing a single example
Reads and parse the examples from alignment dataset in TF record format
[ "Reads", "and", "parse", "the", "examples", "from", "alignment", "dataset", "in", "TF", "record", "format" ]
def TFRQ_feeding(filename_queue, feat_dim, seq_len): reader = tf.TFRecordReader() _, serialized_example = reader.read(filename_queue) example = tf.parse_single_example(serialized_example, features={ 'feat': tf.FixedLenFeature([seq_len,feat_dim],dtype=tf.float32), 'label':tf.F...
[ "def", "TFRQ_feeding", "(", "filename_queue", ",", "feat_dim", ",", "seq_len", ")", ":", "reader", "=", "tf", ".", "TFRecordReader", "(", ")", "_", ",", "serialized_example", "=", "reader", ".", "read", "(", "filename_queue", ")", "example", "=", "tf", "."...
Reads and parse the examples from alignment dataset in TF record format
[ "Reads", "and", "parse", "the", "examples", "from", "alignment", "dataset", "in", "TF", "record", "format" ]
[ "\"\"\" Reads and parse the examples from alignment dataset \n in TF record format \n Args: \n filename_queue: A queue of strings with the filenames to read from \n feat_dim : feature dimension \n seq_len : sequence length (padded)\n\n Returns:\n An object representing a single exam...
[ { "param": "filename_queue", "type": null }, { "param": "feat_dim", "type": null }, { "param": "seq_len", "type": null } ]
{ "returns": [ { "docstring": "An object representing a single example", "docstring_tokens": [ "An", "object", "representing", "a", "single", "example" ], "type": null } ], "raises": [], "params": [ { "identifier": "filena...
3631e3b7bc70f5f6beb699862f98061333ceffec
hoaaoh/Audio2Vec
src/audio2vec_train.py
[ "Apache-2.0" ]
Python
batch_pipeline
<not_specific>
def batch_pipeline(filenames, batch_size, feat_dim, seq_len, \ num_epochs=None): """ Building Input data graph examples: list of 2-D tensors in batch labels: list of 2-D tensors in batch """ filename_queue = tf.train.string_input_producer(filenames, shuffle=True) # results = tf.unstack(...
Building Input data graph examples: list of 2-D tensors in batch labels: list of 2-D tensors in batch
Building Input data graph examples: list of 2-D tensors in batch labels: list of 2-D tensors in batch
[ "Building", "Input", "data", "graph", "examples", ":", "list", "of", "2", "-", "D", "tensors", "in", "batch", "labels", ":", "list", "of", "2", "-", "D", "tensors", "in", "batch" ]
def batch_pipeline(filenames, batch_size, feat_dim, seq_len, \ num_epochs=None): filename_queue = tf.train.string_input_producer(filenames, shuffle=True) result = TFRQ_feeding(filename_queue, feat_dim, seq_len) min_after_dequeue = 5000 capacity = min_after_dequeue + 8 * batch_size example_batch,...
[ "def", "batch_pipeline", "(", "filenames", ",", "batch_size", ",", "feat_dim", ",", "seq_len", ",", "num_epochs", "=", "None", ")", ":", "filename_queue", "=", "tf", ".", "train", ".", "string_input_producer", "(", "filenames", ",", "shuffle", "=", "True", "...
Building Input data graph examples: list of 2-D tensors in batch labels: list of 2-D tensors in batch
[ "Building", "Input", "data", "graph", "examples", ":", "list", "of", "2", "-", "D", "tensors", "in", "batch", "labels", ":", "list", "of", "2", "-", "D", "tensors", "in", "batch" ]
[ "\"\"\" \n Building Input data graph\n examples: list of 2-D tensors in batch\n labels: list of 2-D tensors in batch\n \"\"\"", "# results = tf.unstack(dataQ_feeding(filename_queue, feat_dim, seq_len))", "# result = dataQ_feeding(filename_queue, feat_dim, seq_len)", "# min_after_dequeue defines ho...
[ { "param": "filenames", "type": null }, { "param": "batch_size", "type": null }, { "param": "feat_dim", "type": null }, { "param": "seq_len", "type": null }, { "param": "num_epochs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filenames", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "batch_size", "type": null, "docstring": null, "docstring...
3631e3b7bc70f5f6beb699862f98061333ceffec
hoaaoh/Audio2Vec
src/audio2vec_train.py
[ "Apache-2.0" ]
Python
memory_regularizer
<not_specific>
def memory_regularizer(enc_mem, batch_size, seq_len, feat_dim): ''' using the memory as the regularization term Args: enc_mem: the encoder memories Return: reg: the regularization term ''' return
using the memory as the regularization term Args: enc_mem: the encoder memories Return: reg: the regularization term
using the memory as the regularization term
[ "using", "the", "memory", "as", "the", "regularization", "term" ]
def memory_regularizer(enc_mem, batch_size, seq_len, feat_dim): return
[ "def", "memory_regularizer", "(", "enc_mem", ",", "batch_size", ",", "seq_len", ",", "feat_dim", ")", ":", "return" ]
using the memory as the regularization term
[ "using", "the", "memory", "as", "the", "regularization", "term" ]
[ "''' using the memory as the regularization term \n Args:\n enc_mem: the encoder memories\n\n Return:\n reg: the regularization term \n '''" ]
[ { "param": "enc_mem", "type": null }, { "param": "batch_size", "type": null }, { "param": "seq_len", "type": null }, { "param": "feat_dim", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "enc_mem", "type": null, "docstring": "the encoder memories", "docstring_tokens": [ "the", "encoder", "memories" ], "default": null, "is_optional": null }, { "identifier":...
3631e3b7bc70f5f6beb699862f98061333ceffec
hoaaoh/Audio2Vec
src/audio2vec_train.py
[ "Apache-2.0" ]
Python
add_loss_summary
<not_specific>
def add_loss_summary(total_loss): """Add summaries for losses in seq2seq model. Generates moving average for all losses and associated summaries for visualizing the performance of the network. Args: total_loss: Total loss from loss(). Returns: loss_avarages_op: op fo generating moving...
Add summaries for losses in seq2seq model. Generates moving average for all losses and associated summaries for visualizing the performance of the network. Args: total_loss: Total loss from loss(). Returns: loss_avarages_op: op fo generating moving averages of losses.
Add summaries for losses in seq2seq model. Generates moving average for all losses and associated summaries for visualizing the performance of the network.
[ "Add", "summaries", "for", "losses", "in", "seq2seq", "model", ".", "Generates", "moving", "average", "for", "all", "losses", "and", "associated", "summaries", "for", "visualizing", "the", "performance", "of", "the", "network", "." ]
def add_loss_summary(total_loss): loss_averages = tf.train.ExponentialMovingAverage(0.9, name='avg') losses = tf.get_collection('losses') return
[ "def", "add_loss_summary", "(", "total_loss", ")", ":", "loss_averages", "=", "tf", ".", "train", ".", "ExponentialMovingAverage", "(", "0.9", ",", "name", "=", "'avg'", ")", "losses", "=", "tf", ".", "get_collection", "(", "'losses'", ")", "return" ]
Add summaries for losses in seq2seq model.
[ "Add", "summaries", "for", "losses", "in", "seq2seq", "model", "." ]
[ "\"\"\"Add summaries for losses in seq2seq model.\n\n Generates moving average for all losses and associated summaries for \n visualizing the performance of the network.\n\n Args:\n total_loss: Total loss from loss().\n Returns:\n loss_avarages_op: op fo generating moving averages of losses.\n...
[ { "param": "total_loss", "type": null } ]
{ "returns": [ { "docstring": "op fo generating moving averages of losses.", "docstring_tokens": [ "op", "fo", "generating", "moving", "averages", "of", "losses", "." ], "type": "loss_avarages_op" } ], "raises": [], ...
3631e3b7bc70f5f6beb699862f98061333ceffec
hoaaoh/Audio2Vec
src/audio2vec_train.py
[ "Apache-2.0" ]
Python
create_train
<not_specific>
def create_train(total_loss, global_step,batch_size): """ Create an optimizer and apply to all trainable variables. Add moving average for all trainable variables. Args: total_loss: Total loss from loss(). global_step: Integer Variable counting the number of training step processe...
Create an optimizer and apply to all trainable variables. Add moving average for all trainable variables. Args: total_loss: Total loss from loss(). global_step: Integer Variable counting the number of training step processed. Returns: train_op: op for training.
Create an optimizer and apply to all trainable variables. Add moving average for all trainable variables.
[ "Create", "an", "optimizer", "and", "apply", "to", "all", "trainable", "variables", ".", "Add", "moving", "average", "for", "all", "trainable", "variables", "." ]
def create_train(total_loss, global_step,batch_size): num_batches_per_epoch = NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN/batch_size decay_steps = int(num_batches_per_epoch * NUM_EPOCHS_PER_DECAY) lr = tf.train.exponential_decay(INITIAL_LEARNING_RATE,global_step, decay_steps, LEARNI...
[ "def", "create_train", "(", "total_loss", ",", "global_step", ",", "batch_size", ")", ":", "num_batches_per_epoch", "=", "NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN", "/", "batch_size", "decay_steps", "=", "int", "(", "num_batches_per_epoch", "*", "NUM_EPOCHS_PER_DECAY", ")", "lr...
Create an optimizer and apply to all trainable variables.
[ "Create", "an", "optimizer", "and", "apply", "to", "all", "trainable", "variables", "." ]
[ "\"\"\" \n Create an optimizer and apply to all trainable variables.\n Add moving average for all trainable variables.\n\n Args: \n total_loss: Total loss from loss().\n global_step: Integer Variable counting the number of training step\n processed.\n Returns:\n train_op: op for tr...
[ { "param": "total_loss", "type": null }, { "param": "global_step", "type": null }, { "param": "batch_size", "type": null } ]
{ "returns": [ { "docstring": "op for training.", "docstring_tokens": [ "op", "for", "training", "." ], "type": "train_op" } ], "raises": [], "params": [ { "identifier": "total_loss", "type": null, "docstring": "Total loss fro...
3631e3b7bc70f5f6beb699862f98061333ceffec
hoaaoh/Audio2Vec
src/audio2vec_train.py
[ "Apache-2.0" ]
Python
train
<not_specific>
def train(fn_list,batch_size, memory_dim, seq_len=50, feat_dim=39): """ Training seq2seq for number of steps.""" with tf.Graph().as_default(): # global_step = tf.Variable(0, trainable=False) # get examples and labels for seq2seq # examples, labels = batch_pipeline(fn_list, batch_size, fe...
Training seq2seq for number of steps.
Training seq2seq for number of steps.
[ "Training", "seq2seq", "for", "number", "of", "steps", "." ]
def train(fn_list,batch_size, memory_dim, seq_len=50, feat_dim=39): with tf.Graph().as_default(): examples, labels = batch_pipeline(fn_list, batch_size, feat_dim, seq_len) dec_out, dec_memory = inference(examples, batch_size, memory_dim, seq_len,\ feat_dim) total_loss = loss(dec_...
[ "def", "train", "(", "fn_list", ",", "batch_size", ",", "memory_dim", ",", "seq_len", "=", "50", ",", "feat_dim", "=", "39", ")", ":", "with", "tf", ".", "Graph", "(", ")", ".", "as_default", "(", ")", ":", "examples", ",", "labels", "=", "batch_pipe...
Training seq2seq for number of steps.
[ "Training", "seq2seq", "for", "number", "of", "steps", "." ]
[ "\"\"\" Training seq2seq for number of steps.\"\"\"", "# global_step = tf.Variable(0, trainable=False)", "# get examples and labels for seq2seq #", "# build a graph that computes the results", "# calculate loss", "### learning rate decay ###", "# build a graph that grains the model with one batch of exa...
[ { "param": "fn_list", "type": null }, { "param": "batch_size", "type": null }, { "param": "memory_dim", "type": null }, { "param": "seq_len", "type": null }, { "param": "feat_dim", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fn_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "batch_size", "type": null, "docstring": null, "docstring_t...
6550796cf22181f07b73dc0f733b5e58e64831ce
hoaaoh/Audio2Vec
src/seq2seq.py
[ "Apache-2.0" ]
Python
basic_rnn_seq2seq_with_bottle_memory
<not_specific>
def basic_rnn_seq2seq_with_bottle_memory(encoder_inputs, decoder_inputs, cell, dtype=dtypes.float32, scope=None): """Basic RNN sequence-to-sequence mode...
Basic RNN sequence-to-sequence model. Args: encoder_inputs: A list of 2D Tensors [batch_size x input_size] decoder_inputs: A list of 2D Tensors [batch_size x input_size] cell: core_rnn_cell.RNNCell defining the cell function and size. dtype: The dtype of the initial state of the RNN cell (...
Basic RNN sequence-to-sequence model.
[ "Basic", "RNN", "sequence", "-", "to", "-", "sequence", "model", "." ]
def basic_rnn_seq2seq_with_bottle_memory(encoder_inputs, decoder_inputs, cell, dtype=dtypes.float32, scope=None): with variable_scope.variable_scope(sco...
[ "def", "basic_rnn_seq2seq_with_bottle_memory", "(", "encoder_inputs", ",", "decoder_inputs", ",", "cell", ",", "dtype", "=", "dtypes", ".", "float32", ",", "scope", "=", "None", ")", ":", "with", "variable_scope", ".", "variable_scope", "(", "scope", "or", "\"ba...
Basic RNN sequence-to-sequence model.
[ "Basic", "RNN", "sequence", "-", "to", "-", "sequence", "model", "." ]
[ "\"\"\"Basic RNN sequence-to-sequence model. \n\n Args:\n encoder_inputs: A list of 2D Tensors [batch_size x input_size]\n decoder_inputs: A list of 2D Tensors [batch_size x input_size]\n cell: core_rnn_cell.RNNCell defining the cell function and size.\n dtype: The dtype of the initial state ...
[ { "param": "encoder_inputs", "type": null }, { "param": "decoder_inputs", "type": null }, { "param": "cell", "type": null }, { "param": "dtype", "type": null }, { "param": "scope", "type": null } ]
{ "returns": [ { "docstring": "A list of the same length as decoder_inputs of 2D Tensors with\nshape [batch_size x output_size] containing the generated outputs.\n\nThe state of each encoder cell in the final time-step.\nThis is a 2D Tensor of shape [batch_size x cell.state_size]\n\nThe state of each decode...
6550796cf22181f07b73dc0f733b5e58e64831ce
hoaaoh/Audio2Vec
src/seq2seq.py
[ "Apache-2.0" ]
Python
stack_rnn_seq2seq_with_bottle_memory
<not_specific>
def stack_rnn_seq2seq_with_bottle_memory(encoder_inputs, decoder_inputs, cell, stack_num=3, dtype=dtypes.float32, s...
Stacking RNN seq2seq model with bottleneck. Args: encoder_inputs: A list of 2D Tensors [batch_size x input_size] decoder_inputs: A list of 2D Tensors [batch_size x input_size] cell: core_rnn_cell.RNNCell defining the cell function and size. stack_num: the number to stack in seq2seq mod...
Stacking RNN seq2seq model with bottleneck.
[ "Stacking", "RNN", "seq2seq", "model", "with", "bottleneck", "." ]
def stack_rnn_seq2seq_with_bottle_memory(encoder_inputs, decoder_inputs, cell, stack_num=3, dtype=dtypes.float32, s...
[ "def", "stack_rnn_seq2seq_with_bottle_memory", "(", "encoder_inputs", ",", "decoder_inputs", ",", "cell", ",", "stack_num", "=", "3", ",", "dtype", "=", "dtypes", ".", "float32", ",", "scope", "=", "None", ")", ":", "with", "variable_scope", ".", "variable_scope...
Stacking RNN seq2seq model with bottleneck.
[ "Stacking", "RNN", "seq2seq", "model", "with", "bottleneck", "." ]
[ "\"\"\"Stacking RNN seq2seq model with bottleneck.\n \n Args:\n encoder_inputs: A list of 2D Tensors [batch_size x input_size] \n decoder_inputs: A list of 2D Tensors [batch_size x input_size]\n cell: core_rnn_cell.RNNCell defining the cell function and size.\n stack_num: the number to sta...
[ { "param": "encoder_inputs", "type": null }, { "param": "decoder_inputs", "type": null }, { "param": "cell", "type": null }, { "param": "stack_num", "type": null }, { "param": "dtype", "type": null }, { "param": "scope", "type": null } ]
{ "returns": [ { "docstring": "A list of the same length as decoer_inputs of 2D Tensors with\nshape [batch_size x output_size] containing the generated outputs.\nenc_state: The state of each encoder cell in the final time_step.\nThis is a 2D Tensor of shape [batch_size x cell.state_size]\ndec_state: The sta...
c96e63c5486572b3259658b8cace7c7d4fc3e3d4
hoaaoh/Audio2Vec
src/Naive.py
[ "Apache-2.0" ]
Python
apply_NE
<not_specific>
def apply_NE(fn): ''' return: feats: the feature list lab: the label list ''' feats, labs = dp.read_csv_file(fn, delimiter=',') lens = gl.gen_len(feats) transed_feats = naive_encoder(feats,lens) return transed_feats, labs
return: feats: the feature list lab: the label list
the feature list lab: the label list
[ "the", "feature", "list", "lab", ":", "the", "label", "list" ]
def apply_NE(fn): feats, labs = dp.read_csv_file(fn, delimiter=',') lens = gl.gen_len(feats) transed_feats = naive_encoder(feats,lens) return transed_feats, labs
[ "def", "apply_NE", "(", "fn", ")", ":", "feats", ",", "labs", "=", "dp", ".", "read_csv_file", "(", "fn", ",", "delimiter", "=", "','", ")", "lens", "=", "gl", ".", "gen_len", "(", "feats", ")", "transed_feats", "=", "naive_encoder", "(", "feats", ",...
return: feats: the feature list lab: the label list
[ "return", ":", "feats", ":", "the", "feature", "list", "lab", ":", "the", "label", "list" ]
[ "'''\n return:\n feats: the feature list\n lab: the label list\n '''" ]
[ { "param": "fn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fn", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
37629bef03eb4e42c6c787347e72b18d1c7e6d5b
hoaaoh/Audio2Vec
src/Bar_plot.py
[ "Apache-2.0" ]
Python
autolabel
null
def autolabel(rects): """ Attach a text label above each bar displaying its height """ for rect in rects: height = rect.get_height() ax.text(rect.get_x() + rect.get_width()/2., 0.01 +height, '%.2f' % float(height), ha='center', va='bottom')
Attach a text label above each bar displaying its height
Attach a text label above each bar displaying its height
[ "Attach", "a", "text", "label", "above", "each", "bar", "displaying", "its", "height" ]
def autolabel(rects): for rect in rects: height = rect.get_height() ax.text(rect.get_x() + rect.get_width()/2., 0.01 +height, '%.2f' % float(height), ha='center', va='bottom')
[ "def", "autolabel", "(", "rects", ")", ":", "for", "rect", "in", "rects", ":", "height", "=", "rect", ".", "get_height", "(", ")", "ax", ".", "text", "(", "rect", ".", "get_x", "(", ")", "+", "rect", ".", "get_width", "(", ")", "/", "2.", ",", ...
Attach a text label above each bar displaying its height
[ "Attach", "a", "text", "label", "above", "each", "bar", "displaying", "its", "height" ]
[ "\"\"\"\n Attach a text label above each bar displaying its height\n \"\"\"" ]
[ { "param": "rects", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rects", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33760e855dc6bff4463a10e4f83190c5736014ab
hoaaoh/Audio2Vec
src/compute_cossim.py
[ "Apache-2.0" ]
Python
edit_distance
<not_specific>
def edit_distance(list1, list2): ''' args: list1: a list with string elements list2: a list with string elements list1 and list2 should have the same type return: compute_mat[-1][-1]: the edit distance of two different list ''' compute_mat = [[0 for i in ...
args: list1: a list with string elements list2: a list with string elements list1 and list2 should have the same type return: compute_mat[-1][-1]: the edit distance of two different list
a list with string elements list2: a list with string elements list1 and list2 should have the same type compute_mat[-1][-1]: the edit distance of two different list
[ "a", "list", "with", "string", "elements", "list2", ":", "a", "list", "with", "string", "elements", "list1", "and", "list2", "should", "have", "the", "same", "type", "compute_mat", "[", "-", "1", "]", "[", "-", "1", "]", ":", "the", "edit", "distance",...
def edit_distance(list1, list2): compute_mat = [[0 for i in range(len(list1)+1) ] for j in range(len(list2)+1)] for i in range(len(list1)+1): compute_mat[0][i] = i for i in range(len(list2)+1): compute_mat[i][0] = i for i in range(1,len(list2)+1): for j in range(1,len(lis...
[ "def", "edit_distance", "(", "list1", ",", "list2", ")", ":", "compute_mat", "=", "[", "[", "0", "for", "i", "in", "range", "(", "len", "(", "list1", ")", "+", "1", ")", "]", "for", "j", "in", "range", "(", "len", "(", "list2", ")", "+", "1", ...
args: list1: a list with string elements list2: a list with string elements list1 and list2 should have the same type
[ "args", ":", "list1", ":", "a", "list", "with", "string", "elements", "list2", ":", "a", "list", "with", "string", "elements", "list1", "and", "list2", "should", "have", "the", "same", "type" ]
[ "'''\n args:\n list1: a list with string elements \n list2: a list with string elements\n list1 and list2 should have the same type\n \n return:\n compute_mat[-1][-1]: the edit distance of two\n different list\n\n '''", "# insertion", "# deletion", "# substitution"...
[ { "param": "list1", "type": null }, { "param": "list2", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "list2", "type": null, "docstring": null, "docstring_tokens":...
087c108a81ab30a55756c116ee64d769e55b6d0d
ClericPy/watchdogs
watchdogs/utils.py
[ "MIT" ]
Python
check_work_time
<not_specific>
def check_work_time(work_hours, now: Optional[datetime] = None): """Check time if fit work_hours. :: Test Code from watchdogs.utils import check_work_time, datetime now = datetime.strptime('2020-03-14 11:47:32', '%Y-%m-%d %H:%M:%S') oks = [ '0, 24', '[1, 2, 3,...
Check time if fit work_hours. :: Test Code from watchdogs.utils import check_work_time, datetime now = datetime.strptime('2020-03-14 11:47:32', '%Y-%m-%d %H:%M:%S') oks = [ '0, 24', '[1, 2, 3, 11]', '[1, 2, 3, 11];%Y==2020', '%d==14', ...
Check time if fit work_hours.
[ "Check", "time", "if", "fit", "work_hours", "." ]
def check_work_time(work_hours, now: Optional[datetime] = None): now = now or datetime.now() if '|' in work_hours: if '&' in work_hours or ';' in work_hours: raise ValueError('| can not use with "&" or ";"') return any((_check_work_time(partial_work_hour, now) for...
[ "def", "check_work_time", "(", "work_hours", ",", "now", ":", "Optional", "[", "datetime", "]", "=", "None", ")", ":", "now", "=", "now", "or", "datetime", ".", "now", "(", ")", "if", "'|'", "in", "work_hours", ":", "if", "'&'", "in", "work_hours", "...
Check time if fit work_hours.
[ "Check", "time", "if", "fit", "work_hours", "." ]
[ "\"\"\"Check time if fit work_hours.\n\n :: Test Code\n\n from watchdogs.utils import check_work_time, datetime\n\n now = datetime.strptime('2020-03-14 11:47:32', '%Y-%m-%d %H:%M:%S')\n\n oks = [\n '0, 24',\n '[1, 2, 3, 11]',\n '[1, 2, 3, 11];%Y==2020',\n ...
[ { "param": "work_hours", "type": null }, { "param": "now", "type": "Optional[datetime]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "work_hours", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "now", "type": "Optional[datetime]", "docstring": null, ...
f6080065a7a626deba2b876316dae87361416115
yujunz/python-anyconfig
anyconfig/backend/xml.py
[ "MIT" ]
Python
elem_to_container
<not_specific>
def elem_to_container(elem, container=dict, **options): """ Convert XML ElementTree Element to a collection of container objects. Elements are transformed to a node under special tagged nodes, attrs, text and children, to store the type of these elements basically, however, in some special cases li...
Convert XML ElementTree Element to a collection of container objects. Elements are transformed to a node under special tagged nodes, attrs, text and children, to store the type of these elements basically, however, in some special cases like the followings, these nodes are attached to the parent n...
Convert XML ElementTree Element to a collection of container objects. Elements are transformed to a node under special tagged nodes, attrs, text and children, to store the type of these elements basically, however, in some special cases like the followings, these nodes are attached to the parent node directly for later...
[ "Convert", "XML", "ElementTree", "Element", "to", "a", "collection", "of", "container", "objects", ".", "Elements", "are", "transformed", "to", "a", "node", "under", "special", "tagged", "nodes", "attrs", "text", "and", "children", "to", "store", "the", "type"...
def elem_to_container(elem, container=dict, **options): dic = container() if elem is None: return dic elem.tag = _tweak_ns(elem.tag, **options) subdic = dic[elem.tag] = container() options["container"] = container if elem.text: _process_elem_text(elem, dic, subdic, **options) ...
[ "def", "elem_to_container", "(", "elem", ",", "container", "=", "dict", ",", "**", "options", ")", ":", "dic", "=", "container", "(", ")", "if", "elem", "is", "None", ":", "return", "dic", "elem", ".", "tag", "=", "_tweak_ns", "(", "elem", ".", "tag"...
Convert XML ElementTree Element to a collection of container objects.
[ "Convert", "XML", "ElementTree", "Element", "to", "a", "collection", "of", "container", "objects", "." ]
[ "\"\"\"\n Convert XML ElementTree Element to a collection of container objects.\n\n Elements are transformed to a node under special tagged nodes, attrs, text\n and children, to store the type of these elements basically, however, in\n some special cases like the followings, these nodes are attached to ...
[ { "param": "elem", "type": null }, { "param": "container", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elem", "type": null, "docstring": "ET Element object or None", "docstring_tokens": [ "ET", "Element", "object", "or", "None" ], "default": null, "is_optional": null ...
f6080065a7a626deba2b876316dae87361416115
yujunz/python-anyconfig
anyconfig/backend/xml.py
[ "MIT" ]
Python
root_to_container
<not_specific>
def root_to_container(root, container=dict, nspaces=None, **options): """ Convert XML ElementTree Root Element to a collection of container objects. :param root: etree root object or None :param container: callble to make a container object :param nspaces: A namespaces dict, {uri: prefix} or None ...
Convert XML ElementTree Root Element to a collection of container objects. :param root: etree root object or None :param container: callble to make a container object :param nspaces: A namespaces dict, {uri: prefix} or None :param options: Keyword options, - tags: Dict of tags for special...
Convert XML ElementTree Root Element to a collection of container objects.
[ "Convert", "XML", "ElementTree", "Root", "Element", "to", "a", "collection", "of", "container", "objects", "." ]
def root_to_container(root, container=dict, nspaces=None, **options): tree = container() if root is None: return tree if nspaces is not None: for uri, prefix in nspaces.items(): root.attrib["xmlns:" + prefix if prefix else "xmlns"] = uri return elem_to_container(root, contain...
[ "def", "root_to_container", "(", "root", ",", "container", "=", "dict", ",", "nspaces", "=", "None", ",", "**", "options", ")", ":", "tree", "=", "container", "(", ")", "if", "root", "is", "None", ":", "return", "tree", "if", "nspaces", "is", "not", ...
Convert XML ElementTree Root Element to a collection of container objects.
[ "Convert", "XML", "ElementTree", "Root", "Element", "to", "a", "collection", "of", "container", "objects", "." ]
[ "\"\"\"\n Convert XML ElementTree Root Element to a collection of container objects.\n\n :param root: etree root object or None\n :param container: callble to make a container object\n :param nspaces: A namespaces dict, {uri: prefix} or None\n :param options: Keyword options,\n\n - tags: Dict ...
[ { "param": "root", "type": null }, { "param": "container", "type": null }, { "param": "nspaces", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "root", "type": null, "docstring": "etree root object or None", "docstring_tokens": [ "etree", "root", "object", "or", "None" ], "default": null, "is_optional": null ...
f6080065a7a626deba2b876316dae87361416115
yujunz/python-anyconfig
anyconfig/backend/xml.py
[ "MIT" ]
Python
container_to_etree
<not_specific>
def container_to_etree(obj, parent=None, to_str=None, **options): """ Convert a dict-like object to XML ElementTree. :param obj: Container instance to convert to :param parent: XML ElementTree parent node object or None :param to_str: Callable to convert value to string or None :param options: ...
Convert a dict-like object to XML ElementTree. :param obj: Container instance to convert to :param parent: XML ElementTree parent node object or None :param to_str: Callable to convert value to string or None :param options: Keyword options, - tags: Dict of tags for special nodes to keep ...
Convert a dict-like object to XML ElementTree.
[ "Convert", "a", "dict", "-", "like", "object", "to", "XML", "ElementTree", "." ]
def container_to_etree(obj, parent=None, to_str=None, **options): if to_str is None: to_str = _to_str_fn(**options) if not anyconfig.utils.is_dict_like(obj): if parent is not None and obj: parent.text = to_str(obj) return parent options = _complement_tag_options(optio...
[ "def", "container_to_etree", "(", "obj", ",", "parent", "=", "None", ",", "to_str", "=", "None", ",", "**", "options", ")", ":", "if", "to_str", "is", "None", ":", "to_str", "=", "_to_str_fn", "(", "**", "options", ")", "if", "not", "anyconfig", ".", ...
Convert a dict-like object to XML ElementTree.
[ "Convert", "a", "dict", "-", "like", "object", "to", "XML", "ElementTree", "." ]
[ "\"\"\"\n Convert a dict-like object to XML ElementTree.\n\n :param obj: Container instance to convert to\n :param parent: XML ElementTree parent node object or None\n :param to_str: Callable to convert value to string or None\n :param options: Keyword options,\n\n - tags: Dict of tags for spe...
[ { "param": "obj", "type": null }, { "param": "parent", "type": null }, { "param": "to_str", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obj", "type": null, "docstring": "Container instance to convert to", "docstring_tokens": [ "Container", "instance", "to", "convert", "to" ], "default": null, "is_option...
d1bc916072dca06eaafeeb781027bc03099cf362
yujunz/python-anyconfig
anyconfig/parser.py
[ "MIT" ]
Python
parse_single
<not_specific>
def parse_single(str_): """ Very simple parser to parse expressions represent some single values. :param str_: a string to parse :return: Int | Bool | String >>> parse_single(None) '' >>> parse_single("0") 0 >>> parse_single("123") 123 >>> parse_single("True") True ...
Very simple parser to parse expressions represent some single values. :param str_: a string to parse :return: Int | Bool | String >>> parse_single(None) '' >>> parse_single("0") 0 >>> parse_single("123") 123 >>> parse_single("True") True >>> parse_single("a string") ...
Very simple parser to parse expressions represent some single values.
[ "Very", "simple", "parser", "to", "parse", "expressions", "represent", "some", "single", "values", "." ]
def parse_single(str_): if str_ is None: return '' str_ = str_.strip() if not str_: return '' if BOOL_PATTERN.match(str_) is not None: return bool(str_) if INT_PATTERN.match(str_) is not None: return int(str_) if STR_PATTERN.match(str_) is not None: return...
[ "def", "parse_single", "(", "str_", ")", ":", "if", "str_", "is", "None", ":", "return", "''", "str_", "=", "str_", ".", "strip", "(", ")", "if", "not", "str_", ":", "return", "''", "if", "BOOL_PATTERN", ".", "match", "(", "str_", ")", "is", "not",...
Very simple parser to parse expressions represent some single values.
[ "Very", "simple", "parser", "to", "parse", "expressions", "represent", "some", "single", "values", "." ]
[ "\"\"\"\n Very simple parser to parse expressions represent some single values.\n\n :param str_: a string to parse\n :return: Int | Bool | String\n\n >>> parse_single(None)\n ''\n >>> parse_single(\"0\")\n 0\n >>> parse_single(\"123\")\n 123\n >>> parse_single(\"True\")\n True\n ...
[ { "param": "str_", "type": null } ]
{ "returns": [ { "docstring": "Int | Bool | String\n>>> parse_single(None)\n''\n>>> parse_single(\"0\")\n0\n>>> parse_single(\"123\")\n123\n>>> parse_single(\"True\")\nTrue\n>>> parse_single(\"a string\")\n'a string'\n>>> parse_single('\"a string\"')\n'a string'\n>>> parse_single(\"'a string'\")\n'a string'...
d1bc916072dca06eaafeeb781027bc03099cf362
yujunz/python-anyconfig
anyconfig/parser.py
[ "MIT" ]
Python
parse_list
<not_specific>
def parse_list(str_, sep=","): """ Simple parser to parse expressions reprensent some list values. :param str_: a string to parse :param sep: Char to separate items of list :return: [Int | Bool | String] >>> parse_list("") [] >>> parse_list("1") [1] >>> parse_list("a,b") ['...
Simple parser to parse expressions reprensent some list values. :param str_: a string to parse :param sep: Char to separate items of list :return: [Int | Bool | String] >>> parse_list("") [] >>> parse_list("1") [1] >>> parse_list("a,b") ['a', 'b'] >>> parse_list("1,2") ...
Simple parser to parse expressions reprensent some list values.
[ "Simple", "parser", "to", "parse", "expressions", "reprensent", "some", "list", "values", "." ]
def parse_list(str_, sep=","): return [parse_single(x) for x in str_.split(sep) if x]
[ "def", "parse_list", "(", "str_", ",", "sep", "=", "\",\"", ")", ":", "return", "[", "parse_single", "(", "x", ")", "for", "x", "in", "str_", ".", "split", "(", "sep", ")", "if", "x", "]" ]
Simple parser to parse expressions reprensent some list values.
[ "Simple", "parser", "to", "parse", "expressions", "reprensent", "some", "list", "values", "." ]
[ "\"\"\"\n Simple parser to parse expressions reprensent some list values.\n\n :param str_: a string to parse\n :param sep: Char to separate items of list\n :return: [Int | Bool | String]\n\n >>> parse_list(\"\")\n []\n >>> parse_list(\"1\")\n [1]\n >>> parse_list(\"a,b\")\n ['a', 'b']\...
[ { "param": "str_", "type": null }, { "param": "sep", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "str_", "type": null, "docstring": "a string to parse", "docstring_tokens": [ "a", "string", ...
d1bc916072dca06eaafeeb781027bc03099cf362
yujunz/python-anyconfig
anyconfig/parser.py
[ "MIT" ]
Python
attr_val_itr
null
def attr_val_itr(str_, avs_sep=":", vs_sep=",", as_sep=";"): """ Atrribute and value pair parser. :param str_: String represents a list of pairs of attribute and value :param avs_sep: char to separate attribute and values :param vs_sep: char to separate values :param as_sep: char to separate at...
Atrribute and value pair parser. :param str_: String represents a list of pairs of attribute and value :param avs_sep: char to separate attribute and values :param vs_sep: char to separate values :param as_sep: char to separate attributes
Atrribute and value pair parser.
[ "Atrribute", "and", "value", "pair", "parser", "." ]
def attr_val_itr(str_, avs_sep=":", vs_sep=",", as_sep=";"): for rel in parse_list(str_, as_sep): if avs_sep not in rel or rel.endswith(avs_sep): continue (_attr, _values) = parse_list(rel, avs_sep) if vs_sep in str(_values): _values = parse_list(_values, vs_sep) ...
[ "def", "attr_val_itr", "(", "str_", ",", "avs_sep", "=", "\":\"", ",", "vs_sep", "=", "\",\"", ",", "as_sep", "=", "\";\"", ")", ":", "for", "rel", "in", "parse_list", "(", "str_", ",", "as_sep", ")", ":", "if", "avs_sep", "not", "in", "rel", "or", ...
Atrribute and value pair parser.
[ "Atrribute", "and", "value", "pair", "parser", "." ]
[ "\"\"\"\n Atrribute and value pair parser.\n\n :param str_: String represents a list of pairs of attribute and value\n :param avs_sep: char to separate attribute and values\n :param vs_sep: char to separate values\n :param as_sep: char to separate attributes\n \"\"\"" ]
[ { "param": "str_", "type": null }, { "param": "avs_sep", "type": null }, { "param": "vs_sep", "type": null }, { "param": "as_sep", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "str_", "type": null, "docstring": "String represents a list of pairs of attribute and value", "docstring_tokens": [ "String", "represents", "a", "list", "of", "pairs", "o...
ffcaee4fc7f2eab4496ee3147a3bd6e332d18f77
yujunz/python-anyconfig
anyconfig/backend/properties.py
[ "MIT" ]
Python
_parseline
<not_specific>
def _parseline(line): """ Parse a line of Java properties file. :param line: A string to parse, must not start with ' ', '#' or '!' (comment) :return: A tuple of (key, value), both key and value may be None >>> _parseline(" ") (None, '') >>> _parseline("aaa:") ('aaa', '') >...
Parse a line of Java properties file. :param line: A string to parse, must not start with ' ', '#' or '!' (comment) :return: A tuple of (key, value), both key and value may be None >>> _parseline(" ") (None, '') >>> _parseline("aaa:") ('aaa', '') >>> _parseline(" aaa:") ('...
Parse a line of Java properties file.
[ "Parse", "a", "line", "of", "Java", "properties", "file", "." ]
def _parseline(line): pair = re.split(r"(?:\s+)?(?:(?<!\\)[=:])", line.strip(), 1) key = pair[0].rstrip() if len(pair) < 2: LOGGER.warning("Invalid line found: %s", line) return (key or None, '') return (key, pair[1].strip())
[ "def", "_parseline", "(", "line", ")", ":", "pair", "=", "re", ".", "split", "(", "r\"(?:\\s+)?(?:(?<!\\\\)[=:])\"", ",", "line", ".", "strip", "(", ")", ",", "1", ")", "key", "=", "pair", "[", "0", "]", ".", "rstrip", "(", ")", "if", "len", "(", ...
Parse a line of Java properties file.
[ "Parse", "a", "line", "of", "Java", "properties", "file", "." ]
[ "\"\"\"\n Parse a line of Java properties file.\n\n :param line:\n A string to parse, must not start with ' ', '#' or '!' (comment)\n :return: A tuple of (key, value), both key and value may be None\n\n >>> _parseline(\" \")\n (None, '')\n >>> _parseline(\"aaa:\")\n ('aaa', '')\n >>> ...
[ { "param": "line", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "line", "type": null, "docstring": "A string to parse, must not start with ' ', '#' or '!' (comment)", "docstring_to...
ffcaee4fc7f2eab4496ee3147a3bd6e332d18f77
yujunz/python-anyconfig
anyconfig/backend/properties.py
[ "MIT" ]
Python
load
<not_specific>
def load(stream, container=dict, comment_markers=_COMMENT_MARKERS): """ Load and parse Java properties file given as a fiel or file-like object `stream`. :param stream: A file or file like object of Java properties files :param container: Factory function to create a dict-like object to sto...
Load and parse Java properties file given as a fiel or file-like object `stream`. :param stream: A file or file like object of Java properties files :param container: Factory function to create a dict-like object to store properties :param comment_markers: Comment markers, e.g. '#' (hash) ...
Load and parse Java properties file given as a fiel or file-like object `stream`.
[ "Load", "and", "parse", "Java", "properties", "file", "given", "as", "a", "fiel", "or", "file", "-", "like", "object", "`", "stream", "`", "." ]
def load(stream, container=dict, comment_markers=_COMMENT_MARKERS): ret = container() prev = "" for line in stream.readlines(): line = _pre_process_line(prev + line.strip().rstrip(), comment_markers) if line is None or not line: continue p...
[ "def", "load", "(", "stream", ",", "container", "=", "dict", ",", "comment_markers", "=", "_COMMENT_MARKERS", ")", ":", "ret", "=", "container", "(", ")", "prev", "=", "\"\"", "for", "line", "in", "stream", ".", "readlines", "(", ")", ":", "line", "=",...
Load and parse Java properties file given as a fiel or file-like object `stream`.
[ "Load", "and", "parse", "Java", "properties", "file", "given", "as", "a", "fiel", "or", "file", "-", "like", "object", "`", "stream", "`", "." ]
[ "\"\"\"\n Load and parse Java properties file given as a fiel or file-like object\n `stream`.\n\n :param stream: A file or file like object of Java properties files\n :param container:\n Factory function to create a dict-like object to store properties\n :param comment_markers: Comment markers...
[ { "param": "stream", "type": null }, { "param": "container", "type": null }, { "param": "comment_markers", "type": null } ]
{ "returns": [ { "docstring": "Dict-like object holding properties\n>>> to_strm = anyconfig.compat.StringIO\n>>> s0 = \"calendar.japanese.type: LocalGregorianCalendar\"\n>>> load(to_strm(''))\n{}\n>>> load(to_strm(\"# \" + s0))\n{}\n>>> load(to_strm(\". \" + s0))\n{}\n>>> load(to_strm(\"calendar.japanese.ty...
16f808211f6dba3c5bb5945fbb28c8498e407699
oddstr13/Optimus-scripts
discord/gridrender.py
[ "MIT" ]
Python
renderPalette
<not_specific>
def renderPalette(pal): """Returns a image rendering of the palette.""" pal_b = pal.tobytes() # RRR... GGG... BBB... R = pal_b[0:256] G = pal_b[256:-256] B = pal_b[-256:] RGB = b''.join(([bytes(c) for c in zip(R,G,B)])) im = Image.frombytes(mode='RGB', data=RGB, size=(1,256)) return im
Returns a image rendering of the palette.
Returns a image rendering of the palette.
[ "Returns", "a", "image", "rendering", "of", "the", "palette", "." ]
def renderPalette(pal): pal_b = pal.tobytes() R = pal_b[0:256] G = pal_b[256:-256] B = pal_b[-256:] RGB = b''.join(([bytes(c) for c in zip(R,G,B)])) im = Image.frombytes(mode='RGB', data=RGB, size=(1,256)) return im
[ "def", "renderPalette", "(", "pal", ")", ":", "pal_b", "=", "pal", ".", "tobytes", "(", ")", "R", "=", "pal_b", "[", "0", ":", "256", "]", "G", "=", "pal_b", "[", "256", ":", "-", "256", "]", "B", "=", "pal_b", "[", "-", "256", ":", "]", "R...
Returns a image rendering of the palette.
[ "Returns", "a", "image", "rendering", "of", "the", "palette", "." ]
[ "\"\"\"Returns a image rendering of the palette.\"\"\"", "# RRR... GGG... BBB..." ]
[ { "param": "pal", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pal", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
16f808211f6dba3c5bb5945fbb28c8498e407699
oddstr13/Optimus-scripts
discord/gridrender.py
[ "MIT" ]
Python
filterGridCircle
<not_specific>
def filterGridCircle(points, n, radius): """Returns points inside circle. Points outside are set to NaN.""" # Code ported from # https://github.com/Smoothieware/Smoothieware/blob/c398f3aa9d2bd6ac2c9328ef0bc08429788d6203/src/modules/tools/zprobe/DeltaGridStrategy.cpp res = points.copy() d = ((radius...
Returns points inside circle. Points outside are set to NaN.
Returns points inside circle. Points outside are set to NaN.
[ "Returns", "points", "inside", "circle", ".", "Points", "outside", "are", "set", "to", "NaN", "." ]
def filterGridCircle(points, n, radius): res = points.copy() d = ((radius * 2) / (n - 1)) for c in range(n): y = -radius + d * c for r in range(n): x = -radius + d * r distance_from_center = (x * x + y * y)**0.5 if not distance_from_center <= radius: ...
[ "def", "filterGridCircle", "(", "points", ",", "n", ",", "radius", ")", ":", "res", "=", "points", ".", "copy", "(", ")", "d", "=", "(", "(", "radius", "*", "2", ")", "/", "(", "n", "-", "1", ")", ")", "for", "c", "in", "range", "(", "n", "...
Returns points inside circle.
[ "Returns", "points", "inside", "circle", "." ]
[ "\"\"\"Returns points inside circle. Points outside are set to NaN.\"\"\"", "# Code ported from", "# https://github.com/Smoothieware/Smoothieware/blob/c398f3aa9d2bd6ac2c9328ef0bc08429788d6203/src/modules/tools/zprobe/DeltaGridStrategy.cpp", "# sqrt" ]
[ { "param": "points", "type": null }, { "param": "n", "type": null }, { "param": "radius", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "points", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": []...
3c1bdd1c99c01f01081a61b0a66919758530097a
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decoders.py
[ "MIT" ]
Python
decode
<not_specific>
def decode(annotation, value): """ Converts an annotated string to a python dictionary. If :annotation: is not empty, use decode_:annotation:(:value:) to convert to dictionary. Existing decoders: annotation decoder [json] decode_json [jwt] decode_jwt ...
Converts an annotated string to a python dictionary. If :annotation: is not empty, use decode_:annotation:(:value:) to convert to dictionary. Existing decoders: annotation decoder [json] decode_json [jwt] decode_jwt [n] where n is a number. De...
Converts an annotated string to a python dictionary. Existing decoders: annotation decoder [json] decode_json [jwt] decode_jwt [n] where n is a number. Decodes the value as an array, and picks item n from the array
[ "Converts", "an", "annotated", "string", "to", "a", "python", "dictionary", ".", "Existing", "decoders", ":", "annotation", "decoder", "[", "json", "]", "decode_json", "[", "jwt", "]", "decode_jwt", "[", "n", "]", "where", "n", "is", "a", "number", ".", ...
def decode(annotation, value): if annotation: if annotation.isdigit(): return value[int(annotation)] module_name = sys.modules[__name__] func_name = DECODE_FUNC_NAME % annotation if hasattr(module_name, func_name): func = getattr(module_name, func_name) ...
[ "def", "decode", "(", "annotation", ",", "value", ")", ":", "if", "annotation", ":", "if", "annotation", ".", "isdigit", "(", ")", ":", "return", "value", "[", "int", "(", "annotation", ")", "]", "module_name", "=", "sys", ".", "modules", "[", "__name_...
Converts an annotated string to a python dictionary.
[ "Converts", "an", "annotated", "string", "to", "a", "python", "dictionary", "." ]
[ "\"\"\"\n Converts an annotated string to a python dictionary.\n\n If :annotation: is not empty, use decode_:annotation:(:value:) to convert to dictionary.\n\n Existing decoders:\n annotation decoder\n [json] decode_json\n [jwt] decode_jwt\n [n] whe...
[ { "param": "annotation", "type": null }, { "param": "value", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "annotation", "type": null, "docstring": "the type of encoding of the value .", "docstring_tokens": [ "the",...
99f19f2c5b889f6325c14a056263fc0602ed43d2
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/classes.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value, group_errors): """ Validates a value against the passed in validators Args: value (any): value to be validated group_errors (bool): flag that indicates if error messages are to be grouped together (if set to False, validation wil...
Validates a value against the passed in validators Args: value (any): value to be validated group_errors (bool): flag that indicates if error messages are to be grouped together (if set to False, validation will end on first error) Returns: ...
Validates a value against the passed in validators
[ "Validates", "a", "value", "against", "the", "passed", "in", "validators" ]
def validate(self, value, group_errors): errors = [] if self._validators: for validator in self._validators: if not validator.validate(value): if hasattr(validator, "_error_message"): errors.append(validator.message(value)) ...
[ "def", "validate", "(", "self", ",", "value", ",", "group_errors", ")", ":", "errors", "=", "[", "]", "if", "self", ".", "_validators", ":", "for", "validator", "in", "self", ".", "_validators", ":", "if", "not", "validator", ".", "validate", "(", "val...
Validates a value against the passed in validators
[ "Validates", "a", "value", "against", "the", "passed", "in", "validators" ]
[ "\"\"\"\n Validates a value against the passed in validators\n\n Args:\n value (any): value to be validated\n group_errors (bool): flag that indicates if error messages are to be grouped together\n (if set to False, validation will end on first error)\n\n Re...
[ { "param": "self", "type": null }, { "param": "value", "type": null }, { "param": "group_errors", "type": null } ]
{ "returns": [ { "docstring": "A list of errors", "docstring_tokens": [ "A", "list", "of", "errors" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_token...
99f19f2c5b889f6325c14a056263fc0602ed43d2
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/classes.py
[ "MIT" ]
Python
extract_value
<not_specific>
def extract_value(self, dict_value): """ Calculate and decode the value of the variable in the given path. Used by the extract_validated_value. Args: dict_value (dict): dictionary to be parsed. Returns: The extracted value """ for path_k...
Calculate and decode the value of the variable in the given path. Used by the extract_validated_value. Args: dict_value (dict): dictionary to be parsed. Returns: The extracted value
Calculate and decode the value of the variable in the given path. Used by the extract_validated_value.
[ "Calculate", "and", "decode", "the", "value", "of", "the", "variable", "in", "the", "given", "path", ".", "Used", "by", "the", "extract_validated_value", "." ]
def extract_value(self, dict_value): for path_key in filter(lambda item: item != "", self._path.split(PATH_DIVIDER)): real_key, annotation = Parameter.get_annotations_from_key(path_key) if dict_value and real_key in dict_value: dict_value = decode(annotation, dict_value[r...
[ "def", "extract_value", "(", "self", ",", "dict_value", ")", ":", "for", "path_key", "in", "filter", "(", "lambda", "item", ":", "item", "!=", "\"\"", ",", "self", ".", "_path", ".", "split", "(", "PATH_DIVIDER", ")", ")", ":", "real_key", ",", "annota...
Calculate and decode the value of the variable in the given path.
[ "Calculate", "and", "decode", "the", "value", "of", "the", "variable", "in", "the", "given", "path", "." ]
[ "\"\"\"\n Calculate and decode the value of the variable in the given path.\n\n Used by the extract_validated_value.\n\n Args:\n dict_value (dict): dictionary to be parsed.\n\n Returns:\n The extracted value\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "dict_value", "type": null } ]
{ "returns": [ { "docstring": "The extracted value", "docstring_tokens": [ "The", "extracted", "value" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [...
99f19f2c5b889f6325c14a056263fc0602ed43d2
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/classes.py
[ "MIT" ]
Python
validate_path
<not_specific>
def validate_path(self, value, group_errors=False): """ Validates a value against the passed in validators Args: value: value to be validated group_errors (bool): flag that indicates if error messages are to be grouped together (if set to False, validatio...
Validates a value against the passed in validators Args: value: value to be validated group_errors (bool): flag that indicates if error messages are to be grouped together (if set to False, validation will end on first error) Returns: A list...
Validates a value against the passed in validators
[ "Validates", "a", "value", "against", "the", "passed", "in", "validators" ]
def validate_path(self, value, group_errors=False): key = self._path.split(PATH_DIVIDER)[-1] errors = self.validate(value, group_errors) return {key: errors} if errors else {}
[ "def", "validate_path", "(", "self", ",", "value", ",", "group_errors", "=", "False", ")", ":", "key", "=", "self", ".", "_path", ".", "split", "(", "PATH_DIVIDER", ")", "[", "-", "1", "]", "errors", "=", "self", ".", "validate", "(", "value", ",", ...
Validates a value against the passed in validators
[ "Validates", "a", "value", "against", "the", "passed", "in", "validators" ]
[ "\"\"\"\n Validates a value against the passed in validators\n\n Args:\n value: value to be validated\n group_errors (bool): flag that indicates if error messages are to be grouped together\n (if set to False, validation will end on first error)\n\n Returns:...
[ { "param": "self", "type": null }, { "param": "value", "type": null }, { "param": "group_errors", "type": null } ]
{ "returns": [ { "docstring": "A list of validation key/pair errors", "docstring_tokens": [ "A", "list", "of", "validation", "key", "/", "pair", "errors" ], "type": null } ], "raises": [], "params": [ { "id...
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
extract_from_event
<not_specific>
def extract_from_event(parameters, group_errors=False, allow_none_defaults=False): """ Extracts a set of parameters from the event dictionary in a lambda handler. The extracted parameters are added as kwargs to the handler function. Usage: @extract_from_event([Parameter(path="/body[json]/my_pa...
Extracts a set of parameters from the event dictionary in a lambda handler. The extracted parameters are added as kwargs to the handler function. Usage: @extract_from_event([Parameter(path="/body[json]/my_param")]) def lambda_handler(event, context, my_param=None) pass Ar...
Extracts a set of parameters from the event dictionary in a lambda handler. The extracted parameters are added as kwargs to the handler function.
[ "Extracts", "a", "set", "of", "parameters", "from", "the", "event", "dictionary", "in", "a", "lambda", "handler", ".", "The", "extracted", "parameters", "are", "added", "as", "kwargs", "to", "the", "handler", "function", "." ]
def extract_from_event(parameters, group_errors=False, allow_none_defaults=False): for param in parameters: param.func_param_name = "event" return extract(parameters, group_errors, allow_none_defaults)
[ "def", "extract_from_event", "(", "parameters", ",", "group_errors", "=", "False", ",", "allow_none_defaults", "=", "False", ")", ":", "for", "param", "in", "parameters", ":", "param", ".", "func_param_name", "=", "\"event\"", "return", "extract", "(", "paramete...
Extracts a set of parameters from the event dictionary in a lambda handler.
[ "Extracts", "a", "set", "of", "parameters", "from", "the", "event", "dictionary", "in", "a", "lambda", "handler", "." ]
[ "\"\"\"\n Extracts a set of parameters from the event dictionary in a lambda handler.\n\n The extracted parameters are added as kwargs to the handler function.\n\n Usage:\n @extract_from_event([Parameter(path=\"/body[json]/my_param\")])\n def lambda_handler(event, context, my_param=None)\n ...
[ { "param": "parameters", "type": null }, { "param": "group_errors", "type": null }, { "param": "allow_none_defaults", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parameters", "type": null, "docstring": "A collection of Parameter type items.", "docstring_tokens": [ "A", "collection", "of", "Parameter", "type", "items", "." ],...
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
extract_from_context
<not_specific>
def extract_from_context(parameters, group_errors=False, allow_none_defaults=False): """ Extracts a set of parameters from the context dictionary in a lambda handler. The extracted parameters are added as kwargs to the handler function. Usage: @extract_from_context([Parameter(path="/parent/my_...
Extracts a set of parameters from the context dictionary in a lambda handler. The extracted parameters are added as kwargs to the handler function. Usage: @extract_from_context([Parameter(path="/parent/my_param")]) def lambda_handler(event, context, my_param=None) pass Ar...
Extracts a set of parameters from the context dictionary in a lambda handler. The extracted parameters are added as kwargs to the handler function.
[ "Extracts", "a", "set", "of", "parameters", "from", "the", "context", "dictionary", "in", "a", "lambda", "handler", ".", "The", "extracted", "parameters", "are", "added", "as", "kwargs", "to", "the", "handler", "function", "." ]
def extract_from_context(parameters, group_errors=False, allow_none_defaults=False): for param in parameters: param.func_param_name = "context" return extract(parameters, group_errors, allow_none_defaults)
[ "def", "extract_from_context", "(", "parameters", ",", "group_errors", "=", "False", ",", "allow_none_defaults", "=", "False", ")", ":", "for", "param", "in", "parameters", ":", "param", ".", "func_param_name", "=", "\"context\"", "return", "extract", "(", "para...
Extracts a set of parameters from the context dictionary in a lambda handler.
[ "Extracts", "a", "set", "of", "parameters", "from", "the", "context", "dictionary", "in", "a", "lambda", "handler", "." ]
[ "\"\"\"\n Extracts a set of parameters from the context dictionary in a lambda handler.\n\n The extracted parameters are added as kwargs to the handler function.\n\n Usage:\n @extract_from_context([Parameter(path=\"/parent/my_param\")])\n def lambda_handler(event, context, my_param=None)\n ...
[ { "param": "parameters", "type": null }, { "param": "group_errors", "type": null }, { "param": "allow_none_defaults", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parameters", "type": null, "docstring": "A collection of Parameter type items.", "docstring_tokens": [ "A", "collection", "of", "Parameter", "type", "items", "." ],...
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
extract
<not_specific>
def extract(parameters, group_errors=False, allow_none_defaults=False): """ Extracts a set of parameters from any function parameter passed to an AWS lambda handler. The extracted parameters are added as kwargs to the handler function. Usage: @extract([Parameter(path="headers/Authorization[jwt...
Extracts a set of parameters from any function parameter passed to an AWS lambda handler. The extracted parameters are added as kwargs to the handler function. Usage: @extract([Parameter(path="headers/Authorization[jwt]/sub", var_name="user_id", func_param_name="event")]) def lambda_handl...
Extracts a set of parameters from any function parameter passed to an AWS lambda handler. The extracted parameters are added as kwargs to the handler function.
[ "Extracts", "a", "set", "of", "parameters", "from", "any", "function", "parameter", "passed", "to", "an", "AWS", "lambda", "handler", ".", "The", "extracted", "parameters", "are", "added", "as", "kwargs", "to", "the", "handler", "function", "." ]
def extract(parameters, group_errors=False, allow_none_defaults=False): def decorator(func): def wrapper(*args, **kwargs): try: param = None errors = [] arg_dictionary = all_func_args(func, args, kwargs) for param in parameters: ...
[ "def", "extract", "(", "parameters", ",", "group_errors", "=", "False", ",", "allow_none_defaults", "=", "False", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "param...
Extracts a set of parameters from any function parameter passed to an AWS lambda handler.
[ "Extracts", "a", "set", "of", "parameters", "from", "any", "function", "parameter", "passed", "to", "an", "AWS", "lambda", "handler", "." ]
[ "\"\"\"\n Extracts a set of parameters from any function parameter passed to an AWS lambda handler.\n\n The extracted parameters are added as kwargs to the handler function.\n\n Usage:\n @extract([Parameter(path=\"headers/Authorization[jwt]/sub\", var_name=\"user_id\", func_param_name=\"event\")])\n...
[ { "param": "parameters", "type": null }, { "param": "group_errors", "type": null }, { "param": "allow_none_defaults", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parameters", "type": null, "docstring": "A collection of Parameter type items.", "docstring_tokens": [ "A", "collection", "of", "Parameter", "type", "items", "." ],...
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
handle_exceptions
<not_specific>
def handle_exceptions(handlers): """ Handles exceptions thrown by the wrapped/decorated function. Usage: @handle_exceptions([ExceptionHandler(exception=KeyError, friendly_message="Your message on KeyError except")]). def lambda_handler(params) pass Args: handlers (l...
Handles exceptions thrown by the wrapped/decorated function. Usage: @handle_exceptions([ExceptionHandler(exception=KeyError, friendly_message="Your message on KeyError except")]). def lambda_handler(params) pass Args: handlers (list): A collection of ExceptionHandler t...
Handles exceptions thrown by the wrapped/decorated function.
[ "Handles", "exceptions", "thrown", "by", "the", "wrapped", "/", "decorated", "function", "." ]
def handle_exceptions(handlers): def decorator(func): def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except tuple(handler.exception for handler in handlers) as ex: failed_handler = [handler for handler in handlers if isinstance(ex, h...
[ "def", "handle_exceptions", "(", "handlers", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "**", "kwargs", ")", "except", ...
Handles exceptions thrown by the wrapped/decorated function.
[ "Handles", "exceptions", "thrown", "by", "the", "wrapped", "/", "decorated", "function", "." ]
[ "\"\"\"\n Handles exceptions thrown by the wrapped/decorated function.\n\n Usage:\n @handle_exceptions([ExceptionHandler(exception=KeyError, friendly_message=\"Your message on KeyError except\")]).\n def lambda_handler(params)\n pass\n\n Args:\n handlers (list): A collection...
[ { "param": "handlers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "handlers", "type": null, "docstring": "A collection of ExceptionHandler type items.", "docstring_tokens": [ "A", "collection", "of", "ExceptionHandler", "type", "items", ...
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
log
<not_specific>
def log(parameters=False, response=False): """ Log parameters and/or response of the wrapped/decorated function using logging package Args: parameters: a flag indicating if the input parameters are to be logged response: a flag indicating if the returned response is to be logged """ ...
Log parameters and/or response of the wrapped/decorated function using logging package Args: parameters: a flag indicating if the input parameters are to be logged response: a flag indicating if the returned response is to be logged
Log parameters and/or response of the wrapped/decorated function using logging package
[ "Log", "parameters", "and", "/", "or", "response", "of", "the", "wrapped", "/", "decorated", "function", "using", "logging", "package" ]
def log(parameters=False, response=False): def decorator(func): def wrapper(*args, **kwargs): if parameters: LOGGER.info(PARAM_LOG_MESSAGE, func.__name__, args) func_response = func(*args, **kwargs) if response: LOGGER.info(RESPONSE_LOG_MES...
[ "def", "log", "(", "parameters", "=", "False", ",", "response", "=", "False", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "if", "parameters", ":", "LOGGER", ".", "info", "(...
Log parameters and/or response of the wrapped/decorated function using logging package
[ "Log", "parameters", "and", "/", "or", "response", "of", "the", "wrapped", "/", "decorated", "function", "using", "logging", "package" ]
[ "\"\"\"\n Log parameters and/or response of the wrapped/decorated function using logging package\n\n Args:\n parameters: a flag indicating if the input parameters are to be logged\n response: a flag indicating if the returned response is to be logged\n \"\"\"" ]
[ { "param": "parameters", "type": null }, { "param": "response", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parameters", "type": null, "docstring": "a flag indicating if the input parameters are to be logged", "docstring_tokens": [ "a", "flag", "indicating", "if", "the", "input", ...
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
extract_from_ssm
<not_specific>
def extract_from_ssm(ssm_parameters): """ Load given ssm parameters from AWS parameter store to the handler variables. Usage: @extract_from_ssm([SSMParameter(ssm_name="key", var_name="var")]) def lambda_handler(var=None) pass Args: ssm_parameters (list): A collectio...
Load given ssm parameters from AWS parameter store to the handler variables. Usage: @extract_from_ssm([SSMParameter(ssm_name="key", var_name="var")]) def lambda_handler(var=None) pass Args: ssm_parameters (list): A collection of SSMParameter type items.
Load given ssm parameters from AWS parameter store to the handler variables.
[ "Load", "given", "ssm", "parameters", "from", "AWS", "parameter", "store", "to", "the", "handler", "variables", "." ]
def extract_from_ssm(ssm_parameters): def decorator(func): def wrapper(*args, **kwargs): ssm = boto3.client("ssm") server_key_containers = ssm.get_parameters( Names=[ssm_parameter.get_ssm_name() for ssm_parameter in ssm_parameters], WithDecryption=True...
[ "def", "extract_from_ssm", "(", "ssm_parameters", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "ssm", "=", "boto3", ".", "client", "(", "\"ssm\"", ")", "server_key_containers", "=...
Load given ssm parameters from AWS parameter store to the handler variables.
[ "Load", "given", "ssm", "parameters", "from", "AWS", "parameter", "store", "to", "the", "handler", "variables", "." ]
[ "\"\"\"\n Load given ssm parameters from AWS parameter store to the handler variables.\n\n Usage:\n @extract_from_ssm([SSMParameter(ssm_name=\"key\", var_name=\"var\")])\n def lambda_handler(var=None)\n pass\n\n Args:\n ssm_parameters (list): A collection of SSMParameter typ...
[ { "param": "ssm_parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ssm_parameters", "type": null, "docstring": "A collection of SSMParameter type items.", "docstring_tokens": [ "A", "collection", "of", "SSMParameter", "type", "items", "....
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
response_body_as_json
<not_specific>
def response_body_as_json(func): """ Convert the dictionary response of the wrapped/decorated function to a json string literal. Usage: @response_body_as_json def lambda_handler(): return {"statusCode": 200, "body": {"key": "value"}} will return {"statusCode": 200, "bod...
Convert the dictionary response of the wrapped/decorated function to a json string literal. Usage: @response_body_as_json def lambda_handler(): return {"statusCode": 200, "body": {"key": "value"}} will return {"statusCode": 200, "body": "{"key":"value"}"}
Convert the dictionary response of the wrapped/decorated function to a json string literal.
[ "Convert", "the", "dictionary", "response", "of", "the", "wrapped", "/", "decorated", "function", "to", "a", "json", "string", "literal", "." ]
def response_body_as_json(func): def wrapper(*args, **kwargs): response = func(*args, **kwargs) if "body" in response: try: response["body"] = json.dumps(response["body"]) except TypeError: return failure(NON_SERIALIZABLE_ERROR_MESSAGE, 500) ...
[ "def", "response_body_as_json", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "response", "=", "func", "(", "*", "args", ",", "**", "kwargs", ")", "if", "\"body\"", "in", "response", ":", "try", ":", "respo...
Convert the dictionary response of the wrapped/decorated function to a json string literal.
[ "Convert", "the", "dictionary", "response", "of", "the", "wrapped", "/", "decorated", "function", "to", "a", "json", "string", "literal", "." ]
[ "\"\"\"\n Convert the dictionary response of the wrapped/decorated function to a json string literal.\n\n Usage:\n @response_body_as_json\n def lambda_handler():\n return {\"statusCode\": 200, \"body\": {\"key\": \"value\"}}\n\n will return {\"statusCode\": 200, \"body\": \"{\"...
[ { "param": "func", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "func", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(parameters, group_errors=False): """ Validates a set of function parameters. Usage: @validate([ValidatedParameter(func_param_name="my_param", validators=[...])]) def func(my_param) pass Args: parameters (list): A collection of ValidatedParameter type it...
Validates a set of function parameters. Usage: @validate([ValidatedParameter(func_param_name="my_param", validators=[...])]) def func(my_param) pass Args: parameters (list): A collection of ValidatedParameter type items. group_errors (bool): flag that indicates...
Validates a set of function parameters.
[ "Validates", "a", "set", "of", "function", "parameters", "." ]
def validate(parameters, group_errors=False): def decorator(func): def wrapper(*args, **kwargs): try: errors = [] arg_dictionary = all_func_args(func, args, kwargs) for param in parameters: param_val = arg_dictionary[param.func_...
[ "def", "validate", "(", "parameters", ",", "group_errors", "=", "False", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "errors", "=", "[", "]", "arg_dictionary", "=...
Validates a set of function parameters.
[ "Validates", "a", "set", "of", "function", "parameters", "." ]
[ "\"\"\"\n Validates a set of function parameters.\n\n Usage:\n @validate([ValidatedParameter(func_param_name=\"my_param\", validators=[...])])\n def func(my_param)\n pass\n\n Args:\n parameters (list): A collection of ValidatedParameter type items.\n group_errors (boo...
[ { "param": "parameters", "type": null }, { "param": "group_errors", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parameters", "type": null, "docstring": "A collection of ValidatedParameter type items.", "docstring_tokens": [ "A", "collection", "of", "ValidatedParameter", "type", "items", ...
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
handle_all_exceptions
<not_specific>
def handle_all_exceptions(): """ Handles all exceptions thrown by the wrapped/decorated function. Usage: @handle_all_exceptions() def lambda_handler(params) pass """ def decorator(func): def wrapper(*args, **kwargs): try: return func(*...
Handles all exceptions thrown by the wrapped/decorated function. Usage: @handle_all_exceptions() def lambda_handler(params) pass
Handles all exceptions thrown by the wrapped/decorated function.
[ "Handles", "all", "exceptions", "thrown", "by", "the", "wrapped", "/", "decorated", "function", "." ]
def handle_all_exceptions(): def decorator(func): def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as ex: LOGGER.error(str(ex)) return failure(str(ex)) return wrapper return decorator
[ "def", "handle_all_exceptions", "(", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "**", "kwargs", ")", "except", "Exceptio...
Handles all exceptions thrown by the wrapped/decorated function.
[ "Handles", "all", "exceptions", "thrown", "by", "the", "wrapped", "/", "decorated", "function", "." ]
[ "\"\"\"\n Handles all exceptions thrown by the wrapped/decorated function.\n\n Usage:\n @handle_all_exceptions()\n def lambda_handler(params)\n pass\n \"\"\"", "# noqa: pylint - catching-non-exception" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6125b72584d9c762cd9d41129ab02fb71b22f99b
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/decorators.py
[ "MIT" ]
Python
hsts
<not_specific>
def hsts(max_age: int = None): """ Adds HSTS header to the response of the decorated function Usage: @hsts(max_age=86400) def func(my_param) pass Args: max_age: An integer to indicate the time browser should remember your domain as HTTPS ...
Adds HSTS header to the response of the decorated function Usage: @hsts(max_age=86400) def func(my_param) pass Args: max_age: An integer to indicate the time browser should remember your domain as HTTPS only communication. If not...
Adds HSTS header to the response of the decorated function Usage: @hsts(max_age=86400) def func(my_param) pass An integer to indicate the time browser should remember your domain as HTTPS only communication. If not specified default value of 2 years is used. The original decorated function response with the additiona...
[ "Adds", "HSTS", "header", "to", "the", "response", "of", "the", "decorated", "function", "Usage", ":", "@hsts", "(", "max_age", "=", "86400", ")", "def", "func", "(", "my_param", ")", "pass", "An", "integer", "to", "indicate", "the", "time", "browser", "...
def hsts(max_age: int = None): def decorator(func): def wrapper(*args, **kwargs): response = func(*args, **kwargs) if isinstance(response, dict): headers_key = find_key_case_insensitive("headers", response) resp_headers = response[headers_key] if heade...
[ "def", "hsts", "(", "max_age", ":", "int", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "response", "=", "func", "(", "*", "args", ",", "**", "kwargs", ")", ...
Adds HSTS header to the response of the decorated function Usage: @hsts(max_age=86400) def func(my_param) pass
[ "Adds", "HSTS", "header", "to", "the", "response", "of", "the", "decorated", "function", "Usage", ":", "@hsts", "(", "max_age", "=", "86400", ")", "def", "func", "(", "my_param", ")", "pass" ]
[ "\"\"\"\n Adds HSTS header to the response of the decorated function\n\n Usage:\n @hsts(max_age=86400)\n def func(my_param)\n pass\n\n Args:\n max_age: An integer to indicate the time browser should remember your domain as HTTPS only communication...
[ { "param": "max_age", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "max_age", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
message
<not_specific>
def message(self, value=None): # noqa: pylint - unused-argument """ Gets the formatted error message for a failed mandatory check Args: value (any): The validated value Returns: The error message """ return self._error_message.format(value=value...
Gets the formatted error message for a failed mandatory check Args: value (any): The validated value Returns: The error message
Gets the formatted error message for a failed mandatory check
[ "Gets", "the", "formatted", "error", "message", "for", "a", "failed", "mandatory", "check" ]
def message(self, value=None): return self._error_message.format(value=value, condition=self._condition)
[ "def", "message", "(", "self", ",", "value", "=", "None", ")", ":", "return", "self", ".", "_error_message", ".", "format", "(", "value", "=", "value", ",", "condition", "=", "self", ".", "_condition", ")" ]
Gets the formatted error message for a failed mandatory check
[ "Gets", "the", "formatted", "error", "message", "for", "a", "failed", "mandatory", "check" ]
[ "# noqa: pylint - unused-argument", "\"\"\"\n Gets the formatted error message for a failed mandatory check\n\n Args:\n value (any): The validated value\n\n Returns:\n The error message\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [ { "docstring": "The error message", "docstring_tokens": [ "The", "error", "message" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(value=None): """ Check if the given mandatory value exists. Args: value (any): Value to be validated. """ return value is not None and str(value)
Check if the given mandatory value exists. Args: value (any): Value to be validated.
Check if the given mandatory value exists.
[ "Check", "if", "the", "given", "mandatory", "value", "exists", "." ]
def validate(value=None): return value is not None and str(value)
[ "def", "validate", "(", "value", "=", "None", ")", ":", "return", "value", "is", "not", "None", "and", "str", "(", "value", ")" ]
Check if the given mandatory value exists.
[ "Check", "if", "the", "given", "mandatory", "value", "exists", "." ]
[ "\"\"\"\n Check if the given mandatory value exists.\n\n Args:\n value (any): Value to be validated.\n \"\"\"" ]
[ { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": "Value to be validated.", "docstring_tokens": [ "Value", "to", "be", "validated", "." ], "default": null, "is_optional": false } ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if a value adheres to the defined regular expression. Args: value (str): Value to be validated. """ if value is None: return True return self._regexp.fullmatch(value) is not None
Check if a value adheres to the defined regular expression. Args: value (str): Value to be validated.
Check if a value adheres to the defined regular expression.
[ "Check", "if", "a", "value", "adheres", "to", "the", "defined", "regular", "expression", "." ]
def validate(self, value=None): if value is None: return True return self._regexp.fullmatch(value) is not None
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "return", "self", ".", "_regexp", ".", "fullmatch", "(", "value", ")", "is", "not", "None" ]
Check if a value adheres to the defined regular expression.
[ "Check", "if", "a", "value", "adheres", "to", "the", "defined", "regular", "expression", "." ]
[ "\"\"\"\n Check if a value adheres to the defined regular expression.\n\n Args:\n value (str): Value to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "Value to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if the object adheres to the defined schema. Args: value (object): Value to be validated. """ try: if value is None: return True return self._condition.validate(value) == value ...
Check if the object adheres to the defined schema. Args: value (object): Value to be validated.
Check if the object adheres to the defined schema.
[ "Check", "if", "the", "object", "adheres", "to", "the", "defined", "schema", "." ]
def validate(self, value=None): try: if value is None: return True return self._condition.validate(value) == value except SchemaError: return False
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "try", ":", "if", "value", "is", "None", ":", "return", "True", "return", "self", ".", "_condition", ".", "validate", "(", "value", ")", "==", "value", "except", "SchemaError", ":", ...
Check if the object adheres to the defined schema.
[ "Check", "if", "the", "object", "adheres", "to", "the", "defined", "schema", "." ]
[ "\"\"\"\n Check if the object adheres to the defined schema.\n\n Args:\n value (object): Value to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "Value to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if the value is greater than the minimum. Args: value (float, int): Value to be validated. """ if value is None: return True if isinstance(value, (float, int)): return self._condition <= value...
Check if the value is greater than the minimum. Args: value (float, int): Value to be validated.
Check if the value is greater than the minimum.
[ "Check", "if", "the", "value", "is", "greater", "than", "the", "minimum", "." ]
def validate(self, value=None): if value is None: return True if isinstance(value, (float, int)): return self._condition <= value return False
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "if", "isinstance", "(", "value", ",", "(", "float", ",", "int", ")", ")", ":", "return", "self", ".", "_condition", "<=", "val...
Check if the value is greater than the minimum.
[ "Check", "if", "the", "value", "is", "greater", "than", "the", "minimum", "." ]
[ "\"\"\"\n Check if the value is greater than the minimum.\n\n Args:\n value (float, int): Value to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "Value to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if the value is less than the maximum. Args: value (float, int): Value to be validated. """ if value is None: return True if isinstance(value, (float, int)): return self._condition >= value ...
Check if the value is less than the maximum. Args: value (float, int): Value to be validated.
Check if the value is less than the maximum.
[ "Check", "if", "the", "value", "is", "less", "than", "the", "maximum", "." ]
def validate(self, value=None): if value is None: return True if isinstance(value, (float, int)): return self._condition >= value return False
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "if", "isinstance", "(", "value", ",", "(", "float", ",", "int", ")", ")", ":", "return", "self", ".", "_condition", ">=", "val...
Check if the value is less than the maximum.
[ "Check", "if", "the", "value", "is", "less", "than", "the", "maximum", "." ]
[ "\"\"\"\n Check if the value is less than the maximum.\n\n Args:\n value (float, int): Value to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "Value to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if a string is shorter than the minimum length. Args: value (str): String to be validated. """ if value is None: return True return len(str(value)) >= self._condition
Check if a string is shorter than the minimum length. Args: value (str): String to be validated.
Check if a string is shorter than the minimum length.
[ "Check", "if", "a", "string", "is", "shorter", "than", "the", "minimum", "length", "." ]
def validate(self, value=None): if value is None: return True return len(str(value)) >= self._condition
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "return", "len", "(", "str", "(", "value", ")", ")", ">=", "self", ".", "_condition" ]
Check if a string is shorter than the minimum length.
[ "Check", "if", "a", "string", "is", "shorter", "than", "the", "minimum", "length", "." ]
[ "\"\"\"\n Check if a string is shorter than the minimum length.\n\n Args:\n value (str): String to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "String to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if a string is longer than the maximum length. Args: value (str): String to be validated. """ if value is None: return True return len(str(value)) <= self._condition
Check if a string is longer than the maximum length. Args: value (str): String to be validated.
Check if a string is longer than the maximum length.
[ "Check", "if", "a", "string", "is", "longer", "than", "the", "maximum", "length", "." ]
def validate(self, value=None): if value is None: return True return len(str(value)) <= self._condition
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "return", "len", "(", "str", "(", "value", ")", ")", "<=", "self", ".", "_condition" ]
Check if a string is longer than the maximum length.
[ "Check", "if", "a", "string", "is", "longer", "than", "the", "maximum", "length", "." ]
[ "\"\"\"\n Check if a string is longer than the maximum length.\n\n Args:\n value (str): String to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "String to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if a value is of the right type Args: value (object): object to be validated. """ if value is None: return True return isinstance(value, self._condition)
Check if a value is of the right type Args: value (object): object to be validated.
Check if a value is of the right type
[ "Check", "if", "a", "value", "is", "of", "the", "right", "type" ]
def validate(self, value=None): if value is None: return True return isinstance(value, self._condition)
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "return", "isinstance", "(", "value", ",", "self", ".", "_condition", ")" ]
Check if a value is of the right type
[ "Check", "if", "a", "value", "is", "of", "the", "right", "type" ]
[ "\"\"\"\n Check if a value is of the right type\n\n Args:\n value (object): object to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "object to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if a value is in a list of valid values Args: value (object): object to be validated. """ if value is None: return True return value in self._condition
Check if a value is in a list of valid values Args: value (object): object to be validated.
Check if a value is in a list of valid values
[ "Check", "if", "a", "value", "is", "in", "a", "list", "of", "valid", "values" ]
def validate(self, value=None): if value is None: return True return value in self._condition
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "return", "value", "in", "self", ".", "_condition" ]
Check if a value is in a list of valid values
[ "Check", "if", "a", "value", "is", "in", "a", "list", "of", "valid", "values" ]
[ "\"\"\"\n Check if a value is in a list of valid values\n\n Args:\n value (object): object to be validated.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "object to be validated.", ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(value=None): """ Check if the given value is non empty. Args: value (any): Value to be validated. """ if value is None or value in (0, 0.0, 0j): return True return bool(value)
Check if the given value is non empty. Args: value (any): Value to be validated.
Check if the given value is non empty.
[ "Check", "if", "the", "given", "value", "is", "non", "empty", "." ]
def validate(value=None): if value is None or value in (0, 0.0, 0j): return True return bool(value)
[ "def", "validate", "(", "value", "=", "None", ")", ":", "if", "value", "is", "None", "or", "value", "in", "(", "0", ",", "0.0", ",", "0j", ")", ":", "return", "True", "return", "bool", "(", "value", ")" ]
Check if the given value is non empty.
[ "Check", "if", "the", "given", "value", "is", "non", "empty", "." ]
[ "\"\"\"\n Check if the given value is non empty.\n\n Args:\n value (any): Value to be validated.\n \"\"\"" ]
[ { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": "Value to be validated.", "docstring_tokens": [ "Value", "to", "be", "validated", "." ], "default": null, "is_optional": false } ...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(self, value=None): """ Check if a string is a date with a given format Args: value (str): string date to validate against a format """ if value is None: return True try: datetime.datetime.strptime(value, self._condition) ...
Check if a string is a date with a given format Args: value (str): string date to validate against a format
Check if a string is a date with a given format
[ "Check", "if", "a", "string", "is", "a", "date", "with", "a", "given", "format" ]
def validate(self, value=None): if value is None: return True try: datetime.datetime.strptime(value, self._condition) except ValueError: return False else: return True
[ "def", "validate", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "try", ":", "datetime", ".", "datetime", ".", "strptime", "(", "value", ",", "self", ".", "_condition", ")", "except", "ValueError"...
Check if a string is a date with a given format
[ "Check", "if", "a", "string", "is", "a", "date", "with", "a", "given", "format" ]
[ "\"\"\"\n Check if a string is a date with a given format\n\n Args:\n value (str): string date to validate against a format\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "string date to validate against...
d242764564810658596fddfbdd6bfa5217e3fb28
gridsmartercities/aws-lambda-decorators
aws_lambda_decorators/validators.py
[ "MIT" ]
Python
validate
<not_specific>
def validate(value=None): """ Check if a string is a valid currency based on ISO 4217 Args: value (str): value to validate against a ISO 4217 """ if value is None: return True return value.upper() in CURRENCIES
Check if a string is a valid currency based on ISO 4217 Args: value (str): value to validate against a ISO 4217
Check if a string is a valid currency based on ISO 4217
[ "Check", "if", "a", "string", "is", "a", "valid", "currency", "based", "on", "ISO", "4217" ]
def validate(value=None): if value is None: return True return value.upper() in CURRENCIES
[ "def", "validate", "(", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "True", "return", "value", ".", "upper", "(", ")", "in", "CURRENCIES" ]
Check if a string is a valid currency based on ISO 4217
[ "Check", "if", "a", "string", "is", "a", "valid", "currency", "based", "on", "ISO", "4217" ]
[ "\"\"\"\n Check if a string is a valid currency based on ISO 4217\n\n Args:\n value (str): value to validate against a ISO 4217\n \"\"\"" ]
[ { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": "value to validate against a ISO 4217", "docstring_tokens": [ "value", "to", "validate", "against", "a", "ISO", "4217" ], "...
19d0b7ff2c8579885bacac594843df86d00375ec
pmundt/pyrefcount
refcount/__init__.py
[ "MIT" ]
Python
add
null
def add(self, value): """ Add to a reference count If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.add(2) >>> ref.usecoun...
Add to a reference count If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.add(2) >>> ref.usecount 3 :param value...
Add to a reference count If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered.
[ "Add", "to", "a", "reference", "count", "If", "the", "reference", "count", "becomes", "higher", "than", "0", "the", "acquire", "callback", "(", "if", "provided", ")", "will", "be", "automatically", "triggered", "." ]
def add(self, value): if self._usecount == 0 and self._acquire: self._usecount += value self._acquire() else: self._usecount += value
[ "def", "add", "(", "self", ",", "value", ")", ":", "if", "self", ".", "_usecount", "==", "0", "and", "self", ".", "_acquire", ":", "self", ".", "_usecount", "+=", "value", "self", ".", "_acquire", "(", ")", "else", ":", "self", ".", "_usecount", "+...
Add to a reference count If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered.
[ "Add", "to", "a", "reference", "count", "If", "the", "reference", "count", "becomes", "higher", "than", "0", "the", "acquire", "callback", "(", "if", "provided", ")", "will", "be", "automatically", "triggered", "." ]
[ "\"\"\"\n Add to a reference count\n\n If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically\n triggered.\n\n >>> from refcount import Refcounter\n >>> ref = Refcounter()\n >>> ref.add(2)\n >>> ref.usecount\n 3\...
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "Amount to add", "docstrin...
19d0b7ff2c8579885bacac594843df86d00375ec
pmundt/pyrefcount
refcount/__init__.py
[ "MIT" ]
Python
inc
null
def inc(self): """ Increment reference count by 1 If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.usecount 1 >>> ...
Increment reference count by 1 If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.usecount 1 >>> ref.inc() >>> ref....
Increment reference count by 1 If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered.
[ "Increment", "reference", "count", "by", "1", "If", "the", "reference", "count", "becomes", "higher", "than", "0", "the", "acquire", "callback", "(", "if", "provided", ")", "will", "be", "automatically", "triggered", "." ]
def inc(self): self.add(1)
[ "def", "inc", "(", "self", ")", ":", "self", ".", "add", "(", "1", ")" ]
Increment reference count by 1 If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered.
[ "Increment", "reference", "count", "by", "1", "If", "the", "reference", "count", "becomes", "higher", "than", "0", "the", "acquire", "callback", "(", "if", "provided", ")", "will", "be", "automatically", "triggered", "." ]
[ "\"\"\"\n Increment reference count by 1\n\n If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically\n triggered.\n\n >>> from refcount import Refcounter\n >>> ref = Refcounter()\n >>> ref.usecount\n 1\n >>> ref.i...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
19d0b7ff2c8579885bacac594843df86d00375ec
pmundt/pyrefcount
refcount/__init__.py
[ "MIT" ]
Python
sub
null
def sub(self, value): """ Subtract from a reference count >>> from refcount import Refcounter >>> ref = Refcounter(usecount=3) >>> ref.usecount 3 >>> ref.sub(2) >>> ref.usecount 1 If the reference count drops to 0, the release callback (i...
Subtract from a reference count >>> from refcount import Refcounter >>> ref = Refcounter(usecount=3) >>> ref.usecount 3 >>> ref.sub(2) >>> ref.usecount 1 If the reference count drops to 0, the release callback (if provided) will be automatically...
If the reference count drops to 0, the release callback (if provided) will be automatically triggered.
[ "If", "the", "reference", "count", "drops", "to", "0", "the", "release", "callback", "(", "if", "provided", ")", "will", "be", "automatically", "triggered", "." ]
def sub(self, value): if self._usecount - value < 0: raise UnderflowException('refcount underflow') self._usecount -= value if self._usecount == 0 and self._release is not None: self._release()
[ "def", "sub", "(", "self", ",", "value", ")", ":", "if", "self", ".", "_usecount", "-", "value", "<", "0", ":", "raise", "UnderflowException", "(", "'refcount underflow'", ")", "self", ".", "_usecount", "-=", "value", "if", "self", ".", "_usecount", "=="...
Subtract from a reference count >>> from refcount import Refcounter >>> ref = Refcounter(usecount=3) >>> ref.usecount 3 >>> ref.sub(2) >>> ref.usecount 1
[ "Subtract", "from", "a", "reference", "count", ">>>", "from", "refcount", "import", "Refcounter", ">>>", "ref", "=", "Refcounter", "(", "usecount", "=", "3", ")", ">>>", "ref", ".", "usecount", "3", ">>>", "ref", ".", "sub", "(", "2", ")", ">>>", "ref"...
[ "\"\"\"\n Subtract from a reference count\n\n >>> from refcount import Refcounter\n >>> ref = Refcounter(usecount=3)\n >>> ref.usecount\n 3\n >>> ref.sub(2)\n >>> ref.usecount\n 1\n\n If the reference count drops to 0, the release callback (if provided)...
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "UnderflowException" } ], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_op...
19d0b7ff2c8579885bacac594843df86d00375ec
pmundt/pyrefcount
refcount/__init__.py
[ "MIT" ]
Python
dec
null
def dec(self): """ Decrement reference count by 1 If the reference count drops to 0, the release callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> def refcount_released(): ... print('no more users') >>> ref = Ref...
Decrement reference count by 1 If the reference count drops to 0, the release callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> def refcount_released(): ... print('no more users') >>> ref = Refcounter(release=refcount_r...
Decrement reference count by 1 If the reference count drops to 0, the release callback (if provided) will be automatically triggered.
[ "Decrement", "reference", "count", "by", "1", "If", "the", "reference", "count", "drops", "to", "0", "the", "release", "callback", "(", "if", "provided", ")", "will", "be", "automatically", "triggered", "." ]
def dec(self): self.sub(1)
[ "def", "dec", "(", "self", ")", ":", "self", ".", "sub", "(", "1", ")" ]
Decrement reference count by 1 If the reference count drops to 0, the release callback (if provided) will be automatically triggered.
[ "Decrement", "reference", "count", "by", "1", "If", "the", "reference", "count", "drops", "to", "0", "the", "release", "callback", "(", "if", "provided", ")", "will", "be", "automatically", "triggered", "." ]
[ "\"\"\"\n Decrement reference count by 1\n\n If the reference count drops to 0, the release callback (if provided) will be automatically triggered.\n\n >>> from refcount import Refcounter\n >>> def refcount_released():\n ... print('no more users')\n >>> ref = Refcounter...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "UnderflowException" } ], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_op...
19d0b7ff2c8579885bacac594843df86d00375ec
pmundt/pyrefcount
refcount/__init__.py
[ "MIT" ]
Python
value
<not_specific>
def value(self): """ Reference count protected value Allows access to the protected value as long as a valid reference count is held. >>> from refcount import RefcountedValue >>> ref = RefcountedValue(value=True) >>> ref.value True >>> ref.dec() ...
Reference count protected value Allows access to the protected value as long as a valid reference count is held. >>> from refcount import RefcountedValue >>> ref = RefcountedValue(value=True) >>> ref.value True >>> ref.dec() >>> ref.value # doctest: +IG...
Reference count protected value Allows access to the protected value as long as a valid reference count is held.
[ "Reference", "count", "protected", "value", "Allows", "access", "to", "the", "protected", "value", "as", "long", "as", "a", "valid", "reference", "count", "is", "held", "." ]
def value(self): if self._usecount == 0: raise NameError('Value referenced with no reference count') return self._value
[ "def", "value", "(", "self", ")", ":", "if", "self", ".", "_usecount", "==", "0", ":", "raise", "NameError", "(", "'Value referenced with no reference count'", ")", "return", "self", ".", "_value" ]
Reference count protected value Allows access to the protected value as long as a valid reference count is held.
[ "Reference", "count", "protected", "value", "Allows", "access", "to", "the", "protected", "value", "as", "long", "as", "a", "valid", "reference", "count", "is", "held", "." ]
[ "\"\"\"\n Reference count protected value\n\n Allows access to the protected value as long as a valid reference count is held.\n\n >>> from refcount import RefcountedValue\n >>> ref = RefcountedValue(value=True)\n >>> ref.value\n True\n >>> ref.dec()\n >>> ref...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [ { "docstring": "Value referenced with no reference count", "docstring_tokens": [ "Value", "referenced", "with", "no", "r...
3e60592acd055f756cad1ef38a65a3fbf114daa1
Ricyteach/msh2cande
msh2cande/common.py
[ "MIT" ]
Python
_nodes_by_number
<not_specific>
def _nodes_by_number(df, *args, seq = None, remove=False): """Filter out nodes from a node dataframe by node number. Provide a node number, a number range, or a sequence/series of numbers. Specify remove=True to remove instead of get. Assumes nodes are stored at column "n".""" maybe_invert = {True: op...
Filter out nodes from a node dataframe by node number. Provide a node number, a number range, or a sequence/series of numbers. Specify remove=True to remove instead of get. Assumes nodes are stored at column "n".
Filter out nodes from a node dataframe by node number. Provide a node number, a number range, or a sequence/series of numbers. Specify remove=True to remove instead of get. Assumes nodes are stored at column "n".
[ "Filter", "out", "nodes", "from", "a", "node", "dataframe", "by", "node", "number", ".", "Provide", "a", "node", "number", "a", "number", "range", "or", "a", "sequence", "/", "series", "of", "numbers", ".", "Specify", "remove", "=", "True", "to", "remove...
def _nodes_by_number(df, *args, seq = None, remove=False): maybe_invert = {True: op.invert, False: lambda x: x}[remove] seq_arg = len(seq) if seq is not None else None if seq_arg and args: raise ValueError("only a sequence of nodes or specified node numbers can be removed, not both") if seq_arg:...
[ "def", "_nodes_by_number", "(", "df", ",", "*", "args", ",", "seq", "=", "None", ",", "remove", "=", "False", ")", ":", "maybe_invert", "=", "{", "True", ":", "op", ".", "invert", ",", "False", ":", "lambda", "x", ":", "x", "}", "[", "remove", "]...
Filter out nodes from a node dataframe by node number.
[ "Filter", "out", "nodes", "from", "a", "node", "dataframe", "by", "node", "number", "." ]
[ "\"\"\"Filter out nodes from a node dataframe by node number.\n\n Provide a node number, a number range, or a sequence/series of numbers.\n\n Specify remove=True to remove instead of get. Assumes nodes are stored at column \"n\".\"\"\"" ]
[ { "param": "df", "type": null }, { "param": "seq", "type": null }, { "param": "remove", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "seq", "type": null, "docstring": null, "docstring_tokens": [], ...
8035df4fc6d6a02ebb64efdf40b1417434ecde41
Ricyteach/msh2cande
msh2cande/msh_load.py
[ "MIT" ]
Python
_dedup_nodes
null
def _dedup_nodes(msh: Msh, tol=0.001): """Modify Msh object such that all nodes are assumed to be unique.""" nodes_df = msh.nodes # change node numbering of firsts (including nodes that later have a dup) c = itertools.count(start=1) firsts_slicer = (nodes_df.duplicated() ^ nodes_df.duplicated(keep...
Modify Msh object such that all nodes are assumed to be unique.
Modify Msh object such that all nodes are assumed to be unique.
[ "Modify", "Msh", "object", "such", "that", "all", "nodes", "are", "assumed", "to", "be", "unique", "." ]
def _dedup_nodes(msh: Msh, tol=0.001): nodes_df = msh.nodes c = itertools.count(start=1) firsts_slicer = (nodes_df.duplicated() ^ nodes_df.duplicated(keep=False)) | ~ nodes_df.duplicated(keep=False) firsts_index = nodes_df[firsts_slicer].index nodes_df.rename({index:str(next(c)) for index in firsts_...
[ "def", "_dedup_nodes", "(", "msh", ":", "Msh", ",", "tol", "=", "0.001", ")", ":", "nodes_df", "=", "msh", ".", "nodes", "c", "=", "itertools", ".", "count", "(", "start", "=", "1", ")", "firsts_slicer", "=", "(", "nodes_df", ".", "duplicated", "(", ...
Modify Msh object such that all nodes are assumed to be unique.
[ "Modify", "Msh", "object", "such", "that", "all", "nodes", "are", "assumed", "to", "be", "unique", "." ]
[ "\"\"\"Modify Msh object such that all nodes are assumed to be unique.\"\"\"", "# change node numbering of firsts (including nodes that later have a dup)", "# temporarily convert first indexes to strs so not overwritten later", "# get first duplicated nodes (\"duped\", excluding the duplicates that come after...
[ { "param": "msh", "type": "Msh" }, { "param": "tol", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "msh", "type": "Msh", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tol", "type": null, "docstring": null, "docstring_tokens": []...
9e1dc76061b98583f76075326de0528f3399366f
mvanderlee/beanstalk-fastapi-socketio
app/app.py
[ "Unlicense" ]
Python
background_thread
null
async def background_thread(): """Example of how to send server generated events to clients.""" while True: await app.sio.sleep(10) print('emitting background generated message') await app.sio.emit('stream_response', random.choice(loading_messages), namespace='/socketio')
Example of how to send server generated events to clients.
Example of how to send server generated events to clients.
[ "Example", "of", "how", "to", "send", "server", "generated", "events", "to", "clients", "." ]
async def background_thread(): while True: await app.sio.sleep(10) print('emitting background generated message') await app.sio.emit('stream_response', random.choice(loading_messages), namespace='/socketio')
[ "async", "def", "background_thread", "(", ")", ":", "while", "True", ":", "await", "app", ".", "sio", ".", "sleep", "(", "10", ")", "print", "(", "'emitting background generated message'", ")", "await", "app", ".", "sio", ".", "emit", "(", "'stream_response'...
Example of how to send server generated events to clients.
[ "Example", "of", "how", "to", "send", "server", "generated", "events", "to", "clients", "." ]
[ "\"\"\"Example of how to send server generated events to clients.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }