partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Mobile.scroll_to_end_horizontally
Scroll the object which has *selectors* attributes to *end* horizontally. See `Scroll Forward Vertically` for more details.
uiautomatorlibrary/Mobile.py
def scroll_to_end_horizontally(self, steps=10, *args, **selectors): """ Scroll the object which has *selectors* attributes to *end* horizontally. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.horiz.toEnd(steps=steps)
def scroll_to_end_horizontally(self, steps=10, *args, **selectors): """ Scroll the object which has *selectors* attributes to *end* horizontally. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.horiz.toEnd(steps=steps)
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "end", "*", "horizontally", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L433-L439
[ "def", "scroll_to_end_horizontally", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "horiz", ".", "toEnd", "(", "step...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_forward_horizontally
Perform scroll forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details.
uiautomatorlibrary/Mobile.py
def scroll_forward_horizontally(self, steps=10, *args, **selectors): """ Perform scroll forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details. """ ret...
def scroll_forward_horizontally(self, steps=10, *args, **selectors): """ Perform scroll forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details. """ ret...
[ "Perform", "scroll", "forward", "(", "horizontally", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L441-L449
[ "def", "scroll_forward_horizontally", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "horiz", ".", "forward", "(", "s...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_backward_horizontally
Perform scroll backward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details.
uiautomatorlibrary/Mobile.py
def scroll_backward_horizontally(self, steps=10, *args, **selectors): """ Perform scroll backward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details. """ r...
def scroll_backward_horizontally(self, steps=10, *args, **selectors): """ Perform scroll backward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details. """ r...
[ "Perform", "scroll", "backward", "(", "horizontally", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L451-L459
[ "def", "scroll_backward_horizontally", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "horiz", ".", "backward", "(", ...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_to_horizontally
Scroll(horizontally) on the object: obj to specific UI object which has *selectors* attributes appears. Return true if the UI object, else return false. See `Scroll To Vertically` for more details.
uiautomatorlibrary/Mobile.py
def scroll_to_horizontally(self, obj, *args,**selectors): """ Scroll(horizontally) on the object: obj to specific UI object which has *selectors* attributes appears. Return true if the UI object, else return false. See `Scroll To Vertically` for more details. """ return...
def scroll_to_horizontally(self, obj, *args,**selectors): """ Scroll(horizontally) on the object: obj to specific UI object which has *selectors* attributes appears. Return true if the UI object, else return false. See `Scroll To Vertically` for more details. """ return...
[ "Scroll", "(", "horizontally", ")", "on", "the", "object", ":", "obj", "to", "specific", "UI", "object", "which", "has", "*", "selectors", "*", "attributes", "appears", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L461-L469
[ "def", "scroll_to_horizontally", "(", "self", ",", "obj", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "obj", ".", "scroll", ".", "horiz", ".", "to", "(", "*", "*", "selectors", ")" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_to_beginning_vertically
Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details.
uiautomatorlibrary/Mobile.py
def scroll_to_beginning_vertically(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toBeginning(steps=steps)
def scroll_to_beginning_vertically(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toBeginning(steps=steps)
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "beginning", "*", "vertically", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L472-L478
[ "def", "scroll_to_beginning_vertically", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "toBeginning", "("...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_to_end_vertically
Scroll the object which has *selectors* attributes to *end* vertically. See `Scroll Forward Vertically` for more details.
uiautomatorlibrary/Mobile.py
def scroll_to_end_vertically(self, steps=10, *args, **selectors): """ Scroll the object which has *selectors* attributes to *end* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toEnd(steps=steps)
def scroll_to_end_vertically(self, steps=10, *args, **selectors): """ Scroll the object which has *selectors* attributes to *end* vertically. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.vert.toEnd(steps=steps)
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "end", "*", "vertically", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L480-L486
[ "def", "scroll_to_end_vertically", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "toEnd", "(", "steps",...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_forward_vertically
Perform scroll forward (vertically)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. Example: | ${can_be_scroll} | Scroll Forward Vertically | className=android.widget.ListView | | # Scroll forward the...
uiautomatorlibrary/Mobile.py
def scroll_forward_vertically(self, steps=10, *args, **selectors): """ Perform scroll forward (vertically)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. Example: | ${can_be_scroll} | Scroll Forward Vertically | className=a...
def scroll_forward_vertically(self, steps=10, *args, **selectors): """ Perform scroll forward (vertically)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. Example: | ${can_be_scroll} | Scroll Forward Vertically | className=a...
[ "Perform", "scroll", "forward", "(", "vertically", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L488-L498
[ "def", "scroll_forward_vertically", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "forward", "(", "step...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_backward_vertically
Perform scroll backward (vertically)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details.
uiautomatorlibrary/Mobile.py
def scroll_backward_vertically(self, steps=10, *args, **selectors): """ Perform scroll backward (vertically)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details. """ retur...
def scroll_backward_vertically(self, steps=10, *args, **selectors): """ Perform scroll backward (vertically)action on the object which has *selectors* attributes. Return whether the object can be Scroll or not. See `Scroll Forward Vertically` for more details. """ retur...
[ "Perform", "scroll", "backward", "(", "vertically", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L500-L508
[ "def", "scroll_backward_vertically", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "backward", "(", "st...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.scroll_to_vertically
Scroll(vertically) on the object: obj to specific UI object which has *selectors* attributes appears. Return true if the UI object, else return false. Example: | ${list} | Get Object | className=android.widget.ListView | | # Get the list object | | ${...
uiautomatorlibrary/Mobile.py
def scroll_to_vertically(self, obj, *args,**selectors): """ Scroll(vertically) on the object: obj to specific UI object which has *selectors* attributes appears. Return true if the UI object, else return false. Example: | ${list} | Get Object | className=andro...
def scroll_to_vertically(self, obj, *args,**selectors): """ Scroll(vertically) on the object: obj to specific UI object which has *selectors* attributes appears. Return true if the UI object, else return false. Example: | ${list} | Get Object | className=andro...
[ "Scroll", "(", "vertically", ")", "on", "the", "object", ":", "obj", "to", "specific", "UI", "object", "which", "has", "*", "selectors", "*", "attributes", "appears", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L510-L521
[ "def", "scroll_to_vertically", "(", "self", ",", "obj", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "obj", ".", "scroll", ".", "vert", ".", "to", "(", "*", "*", "selectors", ")" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.screenshot
Take a screenshot of device and log in the report with timestamp, scale for screenshot size and quality for screenshot quality default scale=1.0 quality=100
uiautomatorlibrary/Mobile.py
def screenshot(self, scale=None, quality=None): """ Take a screenshot of device and log in the report with timestamp, scale for screenshot size and quality for screenshot quality default scale=1.0 quality=100 """ output_dir = BuiltIn().get_variable_value('${OUTPUTDIR}') t...
def screenshot(self, scale=None, quality=None): """ Take a screenshot of device and log in the report with timestamp, scale for screenshot size and quality for screenshot quality default scale=1.0 quality=100 """ output_dir = BuiltIn().get_variable_value('${OUTPUTDIR}') t...
[ "Take", "a", "screenshot", "of", "device", "and", "log", "in", "the", "report", "with", "timestamp", "scale", "for", "screenshot", "size", "and", "quality", "for", "screenshot", "quality", "default", "scale", "=", "1", ".", "0", "quality", "=", "100" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L564-L574
[ "def", "screenshot", "(", "self", ",", "scale", "=", "None", ",", "quality", "=", "None", ")", ":", "output_dir", "=", "BuiltIn", "(", ")", ".", "get_variable_value", "(", "'${OUTPUTDIR}'", ")", "ts", "=", "time", ".", "time", "(", ")", "st", "=", "d...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.register_click_watcher
The watcher click on the object which has the *selectors* when conditions match.
uiautomatorlibrary/Mobile.py
def register_click_watcher(self, watcher_name, selectors, *condition_list): """ The watcher click on the object which has the *selectors* when conditions match. """ watcher = self.device.watcher(watcher_name) for condition in condition_list: watcher.when(**self.__unic...
def register_click_watcher(self, watcher_name, selectors, *condition_list): """ The watcher click on the object which has the *selectors* when conditions match. """ watcher = self.device.watcher(watcher_name) for condition in condition_list: watcher.when(**self.__unic...
[ "The", "watcher", "click", "on", "the", "object", "which", "has", "the", "*", "selectors", "*", "when", "conditions", "match", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L592-L600
[ "def", "register_click_watcher", "(", "self", ",", "watcher_name", ",", "selectors", ",", "*", "condition_list", ")", ":", "watcher", "=", "self", ".", "device", ".", "watcher", "(", "watcher_name", ")", "for", "condition", "in", "condition_list", ":", "watche...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.register_press_watcher
The watcher perform *press_keys* action sequentially when conditions match.
uiautomatorlibrary/Mobile.py
def register_press_watcher(self, watcher_name, press_keys, *condition_list): """ The watcher perform *press_keys* action sequentially when conditions match. """ def unicode_to_list(a_unicode): a_list = list() comma_count = a_unicode.count(',') for coun...
def register_press_watcher(self, watcher_name, press_keys, *condition_list): """ The watcher perform *press_keys* action sequentially when conditions match. """ def unicode_to_list(a_unicode): a_list = list() comma_count = a_unicode.count(',') for coun...
[ "The", "watcher", "perform", "*", "press_keys", "*", "action", "sequentially", "when", "conditions", "match", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L602-L622
[ "def", "register_press_watcher", "(", "self", ",", "watcher_name", ",", "press_keys", ",", "*", "condition_list", ")", ":", "def", "unicode_to_list", "(", "a_unicode", ")", ":", "a_list", "=", "list", "(", ")", "comma_count", "=", "a_unicode", ".", "count", ...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.remove_watchers
Remove watcher with *watcher_name* or remove all watchers.
uiautomatorlibrary/Mobile.py
def remove_watchers(self, watcher_name = None): """ Remove watcher with *watcher_name* or remove all watchers. """ if watcher_name == None: self.device.watchers.remove() else: self.device.watchers.remove(watcher_name)
def remove_watchers(self, watcher_name = None): """ Remove watcher with *watcher_name* or remove all watchers. """ if watcher_name == None: self.device.watchers.remove() else: self.device.watchers.remove(watcher_name)
[ "Remove", "watcher", "with", "*", "watcher_name", "*", "or", "remove", "all", "watchers", "." ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L624-L631
[ "def", "remove_watchers", "(", "self", ",", "watcher_name", "=", "None", ")", ":", "if", "watcher_name", "==", "None", ":", "self", ".", "device", ".", "watchers", ".", "remove", "(", ")", "else", ":", "self", ".", "device", ".", "watchers", ".", "remo...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.get_count
Return the count of UI object with *selectors* Example: | ${count} | Get Count | text=Accessibility | # Get the count of UI object text=Accessibility | | ${accessibility_text} | Get Object | text=Accessibility | # These two keywords combination ...
uiautomatorlibrary/Mobile.py
def get_count(self, *args, **selectors): """ Return the count of UI object with *selectors* Example: | ${count} | Get Count | text=Accessibility | # Get the count of UI object text=Accessibility | | ${accessibility_text} | Get Object | text=Ac...
def get_count(self, *args, **selectors): """ Return the count of UI object with *selectors* Example: | ${count} | Get Count | text=Accessibility | # Get the count of UI object text=Accessibility | | ${accessibility_text} | Get Object | text=Ac...
[ "Return", "the", "count", "of", "UI", "object", "with", "*", "selectors", "*" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L670-L682
[ "def", "get_count", "(", "self", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "obj", "=", "self", ".", "get_object", "(", "*", "*", "selectors", ")", "return", "self", ".", "get_count_of_object", "(", "obj", ")" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.get_info_of_object
return info dictionary of the *obj* The info example: { u'contentDescription': u'', u'checked': False, u'scrollable': True, u'text': u'', u'packageName': u'com.android.launcher', u'selected': False, u'enabled': True, u'bounds': ...
uiautomatorlibrary/Mobile.py
def get_info_of_object(self, obj, selector=None): """ return info dictionary of the *obj* The info example: { u'contentDescription': u'', u'checked': False, u'scrollable': True, u'text': u'', u'packageName': u'com.android.launcher', u...
def get_info_of_object(self, obj, selector=None): """ return info dictionary of the *obj* The info example: { u'contentDescription': u'', u'checked': False, u'scrollable': True, u'text': u'', u'packageName': u'com.android.launcher', u...
[ "return", "info", "dictionary", "of", "the", "*", "obj", "*", "The", "info", "example", ":", "{", "u", "contentDescription", ":", "u", "u", "checked", ":", "False", "u", "scrollable", ":", "True", "u", "text", ":", "u", "u", "packageName", ":", "u", ...
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L692-L730
[ "def", "get_info_of_object", "(", "self", ",", "obj", ",", "selector", "=", "None", ")", ":", "if", "selector", ":", "return", "obj", ".", "info", ".", "get", "(", "selector", ")", "else", ":", "return", "obj", ".", "info" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.call
This keyword can use object method from original python uiautomator See more details from https://github.com/xiaocong/uiautomator Example: | ${accessibility_text} | Get Object | text=Accessibility | # Get the UI object | | Call | ${ac...
uiautomatorlibrary/Mobile.py
def call(self, obj, method, *args, **selectors): """ This keyword can use object method from original python uiautomator See more details from https://github.com/xiaocong/uiautomator Example: | ${accessibility_text} | Get Object | text=Accessibility | # Get the UI o...
def call(self, obj, method, *args, **selectors): """ This keyword can use object method from original python uiautomator See more details from https://github.com/xiaocong/uiautomator Example: | ${accessibility_text} | Get Object | text=Accessibility | # Get the UI o...
[ "This", "keyword", "can", "use", "object", "method", "from", "original", "python", "uiautomator" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L758-L770
[ "def", "call", "(", "self", ",", "obj", ",", "method", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "func", "=", "getattr", "(", "obj", ",", "method", ")", "return", "func", "(", "*", "*", "selectors", ")" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.set_text
Set *input_text* to the UI object with *selectors*
uiautomatorlibrary/Mobile.py
def set_text(self, input_text, *args, **selectors): """ Set *input_text* to the UI object with *selectors* """ self.device(**selectors).set_text(input_text)
def set_text(self, input_text, *args, **selectors): """ Set *input_text* to the UI object with *selectors* """ self.device(**selectors).set_text(input_text)
[ "Set", "*", "input_text", "*", "to", "the", "UI", "object", "with", "*", "selectors", "*" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L772-L776
[ "def", "set_text", "(", "self", ",", "input_text", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "set_text", "(", "input_text", ")" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.clear_text
Clear text of the UI object with *selectors*
uiautomatorlibrary/Mobile.py
def clear_text(self, *args, **selectors): """ Clear text of the UI object with *selectors* """ while True: target = self.device(**selectors) text = target.info['text'] target.clear_text() remain_text = target.info['text'] if te...
def clear_text(self, *args, **selectors): """ Clear text of the UI object with *selectors* """ while True: target = self.device(**selectors) text = target.info['text'] target.clear_text() remain_text = target.info['text'] if te...
[ "Clear", "text", "of", "the", "UI", "object", "with", "*", "selectors", "*" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L786-L796
[ "def", "clear_text", "(", "self", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "while", "True", ":", "target", "=", "self", ".", "device", "(", "*", "*", "selectors", ")", "text", "=", "target", ".", "info", "[", "'text'", "]", "target",...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.open_notification
Open notification Built in support for Android 4.3 (API level 18) Using swipe action as a workaround for API level lower than 18
uiautomatorlibrary/Mobile.py
def open_notification(self): """ Open notification Built in support for Android 4.3 (API level 18) Using swipe action as a workaround for API level lower than 18 """ sdk_version = self.device.info['sdkInt'] if sdk_version < 18: height = self.device....
def open_notification(self): """ Open notification Built in support for Android 4.3 (API level 18) Using swipe action as a workaround for API level lower than 18 """ sdk_version = self.device.info['sdkInt'] if sdk_version < 18: height = self.device....
[ "Open", "notification" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L798-L812
[ "def", "open_notification", "(", "self", ")", ":", "sdk_version", "=", "self", ".", "device", ".", "info", "[", "'sdkInt'", "]", "if", "sdk_version", "<", "18", ":", "height", "=", "self", ".", "device", ".", "info", "[", "'displayHeight'", "]", "self", ...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.sleep
Sleep(no action) for *time* (in millisecond)
uiautomatorlibrary/Mobile.py
def sleep(self, time): """ Sleep(no action) for *time* (in millisecond) """ target = 'wait for %s' % str(time) self.device(text=target).wait.exists(timeout=time)
def sleep(self, time): """ Sleep(no action) for *time* (in millisecond) """ target = 'wait for %s' % str(time) self.device(text=target).wait.exists(timeout=time)
[ "Sleep", "(", "no", "action", ")", "for", "*", "time", "*", "(", "in", "millisecond", ")" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L823-L828
[ "def", "sleep", "(", "self", ",", "time", ")", ":", "target", "=", "'wait for %s'", "%", "str", "(", "time", ")", "self", ".", "device", "(", "text", "=", "target", ")", ".", "wait", ".", "exists", "(", "timeout", "=", "time", ")" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
Mobile.connect_to_wifi
[Test Agent] Connect to *ssid* with *password*
uiautomatorlibrary/Mobile.py
def connect_to_wifi(self, ssid, password=None): """ [Test Agent] Connect to *ssid* with *password* """ cmd = 'am broadcast -a testagent -e action CONNECT_TO_WIFI -e ssid %s -e password %s' % (ssid, password) self.adb.shell_cmd(cmd)
def connect_to_wifi(self, ssid, password=None): """ [Test Agent] Connect to *ssid* with *password* """ cmd = 'am broadcast -a testagent -e action CONNECT_TO_WIFI -e ssid %s -e password %s' % (ssid, password) self.adb.shell_cmd(cmd)
[ "[", "Test", "Agent", "]" ]
ming060/robotframework-uiautomatorlibrary
python
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L884-L891
[ "def", "connect_to_wifi", "(", "self", ",", "ssid", ",", "password", "=", "None", ")", ":", "cmd", "=", "'am broadcast -a testagent -e action CONNECT_TO_WIFI -e ssid %s -e password %s'", "%", "(", "ssid", ",", "password", ")", "self", ".", "adb", ".", "shell_cmd", ...
b70202b6a8aa68b4efd9d029c2845407fb33451a
train
merge_sims
Merge two precomputed similarity lists, truncating the result to `clip` most similar items.
simserver/simserver.py
def merge_sims(oldsims, newsims, clip=None): """Merge two precomputed similarity lists, truncating the result to `clip` most similar items.""" if oldsims is None: result = newsims or [] elif newsims is None: result = oldsims else: result = sorted(oldsims + newsims, key=lambda ite...
def merge_sims(oldsims, newsims, clip=None): """Merge two precomputed similarity lists, truncating the result to `clip` most similar items.""" if oldsims is None: result = newsims or [] elif newsims is None: result = oldsims else: result = sorted(oldsims + newsims, key=lambda ite...
[ "Merge", "two", "precomputed", "similarity", "lists", "truncating", "the", "result", "to", "clip", "most", "similar", "items", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L49-L59
[ "def", "merge_sims", "(", "oldsims", ",", "newsims", ",", "clip", "=", "None", ")", ":", "if", "oldsims", "is", "None", ":", "result", "=", "newsims", "or", "[", "]", "elif", "newsims", "is", "None", ":", "result", "=", "oldsims", "else", ":", "resul...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.terminate
Delete all files created by this index, invalidating `self`. Use with care.
simserver/simserver.py
def terminate(self): """Delete all files created by this index, invalidating `self`. Use with care.""" try: self.id2sims.terminate() except: pass import glob for fname in glob.glob(self.fname + '*'): try: os.remove(fname) ...
def terminate(self): """Delete all files created by this index, invalidating `self`. Use with care.""" try: self.id2sims.terminate() except: pass import glob for fname in glob.glob(self.fname + '*'): try: os.remove(fname) ...
[ "Delete", "all", "files", "created", "by", "this", "index", "invalidating", "self", ".", "Use", "with", "care", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L120-L137
[ "def", "terminate", "(", "self", ")", ":", "try", ":", "self", ".", "id2sims", ".", "terminate", "(", ")", "except", ":", "pass", "import", "glob", "for", "fname", "in", "glob", ".", "glob", "(", "self", ".", "fname", "+", "'*'", ")", ":", "try", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.index_documents
Update fresh index with new documents (potentially replacing old ones with the same id). `fresh_docs` is a dictionary-like object (=dict, sqlitedict, shelve etc) that maps document_id->document.
simserver/simserver.py
def index_documents(self, fresh_docs, model): """ Update fresh index with new documents (potentially replacing old ones with the same id). `fresh_docs` is a dictionary-like object (=dict, sqlitedict, shelve etc) that maps document_id->document. """ docids = fresh_docs.key...
def index_documents(self, fresh_docs, model): """ Update fresh index with new documents (potentially replacing old ones with the same id). `fresh_docs` is a dictionary-like object (=dict, sqlitedict, shelve etc) that maps document_id->document. """ docids = fresh_docs.key...
[ "Update", "fresh", "index", "with", "new", "documents", "(", "potentially", "replacing", "old", "ones", "with", "the", "same", "id", ")", ".", "fresh_docs", "is", "a", "dictionary", "-", "like", "object", "(", "=", "dict", "sqlitedict", "shelve", "etc", ")...
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L140-L151
[ "def", "index_documents", "(", "self", ",", "fresh_docs", ",", "model", ")", ":", "docids", "=", "fresh_docs", ".", "keys", "(", ")", "vectors", "=", "(", "model", ".", "docs2vecs", "(", "fresh_docs", "[", "docid", "]", "for", "docid", "in", "docids", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.update_ids
Update id->pos mapping with new document ids.
simserver/simserver.py
def update_ids(self, docids): """Update id->pos mapping with new document ids.""" logger.info("updating %i id mappings" % len(docids)) for docid in docids: if docid is not None: pos = self.id2pos.get(docid, None) if pos is not None: ...
def update_ids(self, docids): """Update id->pos mapping with new document ids.""" logger.info("updating %i id mappings" % len(docids)) for docid in docids: if docid is not None: pos = self.id2pos.get(docid, None) if pos is not None: ...
[ "Update", "id", "-", ">", "pos", "mapping", "with", "new", "document", "ids", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L154-L170
[ "def", "update_ids", "(", "self", ",", "docids", ")", ":", "logger", ".", "info", "(", "\"updating %i id mappings\"", "%", "len", "(", "docids", ")", ")", "for", "docid", "in", "docids", ":", "if", "docid", "is", "not", "None", ":", "pos", "=", "self",...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.update_mappings
Synchronize id<->position mappings.
simserver/simserver.py
def update_mappings(self): """Synchronize id<->position mappings.""" self.pos2id = dict((v, k) for k, v in self.id2pos.iteritems()) assert len(self.pos2id) == len(self.id2pos), "duplicate ids or positions detected"
def update_mappings(self): """Synchronize id<->position mappings.""" self.pos2id = dict((v, k) for k, v in self.id2pos.iteritems()) assert len(self.pos2id) == len(self.id2pos), "duplicate ids or positions detected"
[ "Synchronize", "id<", "-", ">", "position", "mappings", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L173-L176
[ "def", "update_mappings", "(", "self", ")", ":", "self", ".", "pos2id", "=", "dict", "(", "(", "v", ",", "k", ")", "for", "k", ",", "v", "in", "self", ".", "id2pos", ".", "iteritems", "(", ")", ")", "assert", "len", "(", "self", ".", "pos2id", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.delete
Delete documents (specified by their ids) from the index.
simserver/simserver.py
def delete(self, docids): """Delete documents (specified by their ids) from the index.""" logger.debug("deleting %i documents from %s" % (len(docids), self)) deleted = 0 for docid in docids: try: del self.id2pos[docid] deleted += 1 ...
def delete(self, docids): """Delete documents (specified by their ids) from the index.""" logger.debug("deleting %i documents from %s" % (len(docids), self)) deleted = 0 for docid in docids: try: del self.id2pos[docid] deleted += 1 ...
[ "Delete", "documents", "(", "specified", "by", "their", "ids", ")", "from", "the", "index", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L179-L193
[ "def", "delete", "(", "self", ",", "docids", ")", ":", "logger", ".", "debug", "(", "\"deleting %i documents from %s\"", "%", "(", "len", "(", "docids", ")", ",", "self", ")", ")", "deleted", "=", "0", "for", "docid", "in", "docids", ":", "try", ":", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.sims2scores
Convert raw similarity vector to a list of (docid, similarity) results.
simserver/simserver.py
def sims2scores(self, sims, eps=1e-7): """Convert raw similarity vector to a list of (docid, similarity) results.""" result = [] if isinstance(sims, numpy.ndarray): sims = abs(sims) # TODO or maybe clip? are opposite vectors "similar" or "dissimilar"?! for pos in numpy.ar...
def sims2scores(self, sims, eps=1e-7): """Convert raw similarity vector to a list of (docid, similarity) results.""" result = [] if isinstance(sims, numpy.ndarray): sims = abs(sims) # TODO or maybe clip? are opposite vectors "similar" or "dissimilar"?! for pos in numpy.ar...
[ "Convert", "raw", "similarity", "vector", "to", "a", "list", "of", "(", "docid", "similarity", ")", "results", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L196-L214
[ "def", "sims2scores", "(", "self", ",", "sims", ",", "eps", "=", "1e-7", ")", ":", "result", "=", "[", "]", "if", "isinstance", "(", "sims", ",", "numpy", ".", "ndarray", ")", ":", "sims", "=", "abs", "(", "sims", ")", "# TODO or maybe clip? are opposi...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.vec_by_id
Return indexed vector corresponding to document `docid`.
simserver/simserver.py
def vec_by_id(self, docid): """Return indexed vector corresponding to document `docid`.""" pos = self.id2pos[docid] return self.qindex.vector_by_id(pos)
def vec_by_id(self, docid): """Return indexed vector corresponding to document `docid`.""" pos = self.id2pos[docid] return self.qindex.vector_by_id(pos)
[ "Return", "indexed", "vector", "corresponding", "to", "document", "docid", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L217-L220
[ "def", "vec_by_id", "(", "self", ",", "docid", ")", ":", "pos", "=", "self", ".", "id2pos", "[", "docid", "]", "return", "self", ".", "qindex", ".", "vector_by_id", "(", "pos", ")" ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.sims_by_id
Find the most similar documents to the (already indexed) document with `docid`.
simserver/simserver.py
def sims_by_id(self, docid): """Find the most similar documents to the (already indexed) document with `docid`.""" result = self.id2sims.get(docid, None) if result is None: self.qindex.num_best = self.topsims sims = self.qindex.similarity_by_id(self.id2pos[docid]) ...
def sims_by_id(self, docid): """Find the most similar documents to the (already indexed) document with `docid`.""" result = self.id2sims.get(docid, None) if result is None: self.qindex.num_best = self.topsims sims = self.qindex.similarity_by_id(self.id2pos[docid]) ...
[ "Find", "the", "most", "similar", "documents", "to", "the", "(", "already", "indexed", ")", "document", "with", "docid", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L223-L230
[ "def", "sims_by_id", "(", "self", ",", "docid", ")", ":", "result", "=", "self", ".", "id2sims", ".", "get", "(", "docid", ",", "None", ")", "if", "result", "is", "None", ":", "self", ".", "qindex", ".", "num_best", "=", "self", ".", "topsims", "si...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.sims_by_vec
Find the most similar documents to a given vector (=already processed document).
simserver/simserver.py
def sims_by_vec(self, vec, normalize=None): """ Find the most similar documents to a given vector (=already processed document). """ if normalize is None: normalize = self.qindex.normalize norm, self.qindex.normalize = self.qindex.normalize, normalize # store old valu...
def sims_by_vec(self, vec, normalize=None): """ Find the most similar documents to a given vector (=already processed document). """ if normalize is None: normalize = self.qindex.normalize norm, self.qindex.normalize = self.qindex.normalize, normalize # store old valu...
[ "Find", "the", "most", "similar", "documents", "to", "a", "given", "vector", "(", "=", "already", "processed", "document", ")", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L233-L243
[ "def", "sims_by_vec", "(", "self", ",", "vec", ",", "normalize", "=", "None", ")", ":", "if", "normalize", "is", "None", ":", "normalize", "=", "self", ".", "qindex", ".", "normalize", "norm", ",", "self", ".", "qindex", ".", "normalize", "=", "self", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimIndex.merge
Merge documents from the other index. Update precomputed similarities in the process.
simserver/simserver.py
def merge(self, other): """Merge documents from the other index. Update precomputed similarities in the process.""" other.qindex.normalize, other.qindex.num_best = False, self.topsims # update precomputed "most similar" for old documents (in case some of # the new docs make it to...
def merge(self, other): """Merge documents from the other index. Update precomputed similarities in the process.""" other.qindex.normalize, other.qindex.num_best = False, self.topsims # update precomputed "most similar" for old documents (in case some of # the new docs make it to...
[ "Merge", "documents", "from", "the", "other", "index", ".", "Update", "precomputed", "similarities", "in", "the", "process", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L246-L291
[ "def", "merge", "(", "self", ",", "other", ")", ":", "other", ".", "qindex", ".", "normalize", ",", "other", ".", "qindex", ".", "num_best", "=", "False", ",", "self", ".", "topsims", "# update precomputed \"most similar\" for old documents (in case some of", "# t...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimModel.doc2vec
Convert a single SimilarityDocument to vector.
simserver/simserver.py
def doc2vec(self, doc): """Convert a single SimilarityDocument to vector.""" bow = self.dictionary.doc2bow(doc['tokens']) if self.method == 'lsi': return self.lsi[self.tfidf[bow]] elif self.method == 'lda': return self.lda[bow] elif self.method == 'lda_tfi...
def doc2vec(self, doc): """Convert a single SimilarityDocument to vector.""" bow = self.dictionary.doc2bow(doc['tokens']) if self.method == 'lsi': return self.lsi[self.tfidf[bow]] elif self.method == 'lda': return self.lda[bow] elif self.method == 'lda_tfi...
[ "Convert", "a", "single", "SimilarityDocument", "to", "vector", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L385-L395
[ "def", "doc2vec", "(", "self", ",", "doc", ")", ":", "bow", "=", "self", ".", "dictionary", ".", "doc2bow", "(", "doc", "[", "'tokens'", "]", ")", "if", "self", ".", "method", "==", "'lsi'", ":", "return", "self", ".", "lsi", "[", "self", ".", "t...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimModel.docs2vecs
Convert multiple SimilarityDocuments to vectors (batch version of doc2vec).
simserver/simserver.py
def docs2vecs(self, docs): """Convert multiple SimilarityDocuments to vectors (batch version of doc2vec).""" bows = (self.dictionary.doc2bow(doc['tokens']) for doc in docs) if self.method == 'lsi': return self.lsi[self.tfidf[bows]] elif self.method == 'lda': retur...
def docs2vecs(self, docs): """Convert multiple SimilarityDocuments to vectors (batch version of doc2vec).""" bows = (self.dictionary.doc2bow(doc['tokens']) for doc in docs) if self.method == 'lsi': return self.lsi[self.tfidf[bows]] elif self.method == 'lda': retur...
[ "Convert", "multiple", "SimilarityDocuments", "to", "vectors", "(", "batch", "version", "of", "doc2vec", ")", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L398-L408
[ "def", "docs2vecs", "(", "self", ",", "docs", ")", ":", "bows", "=", "(", "self", ".", "dictionary", ".", "doc2bow", "(", "doc", "[", "'tokens'", "]", ")", "for", "doc", "in", "docs", ")", "if", "self", ".", "method", "==", "'lsi'", ":", "return", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.flush
Commit all changes, clear all caches.
simserver/simserver.py
def flush(self, save_index=False, save_model=False, clear_buffer=False): """Commit all changes, clear all caches.""" if save_index: if self.fresh_index is not None: self.fresh_index.save(self.location('index_fresh')) if self.opt_index is not None: ...
def flush(self, save_index=False, save_model=False, clear_buffer=False): """Commit all changes, clear all caches.""" if save_index: if self.fresh_index is not None: self.fresh_index.save(self.location('index_fresh')) if self.opt_index is not None: ...
[ "Commit", "all", "changes", "clear", "all", "caches", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L481-L499
[ "def", "flush", "(", "self", ",", "save_index", "=", "False", ",", "save_model", "=", "False", ",", "clear_buffer", "=", "False", ")", ":", "if", "save_index", ":", "if", "self", ".", "fresh_index", "is", "not", "None", ":", "self", ".", "fresh_index", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.close
Explicitly close open file handles, databases etc.
simserver/simserver.py
def close(self): """Explicitly close open file handles, databases etc.""" try: self.payload.close() except: pass try: self.model.close() except: pass try: self.fresh_index.close() except: pass...
def close(self): """Explicitly close open file handles, databases etc.""" try: self.payload.close() except: pass try: self.model.close() except: pass try: self.fresh_index.close() except: pass...
[ "Explicitly", "close", "open", "file", "handles", "databases", "etc", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L502-L523
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "payload", ".", "close", "(", ")", "except", ":", "pass", "try", ":", "self", ".", "model", ".", "close", "(", ")", "except", ":", "pass", "try", ":", "self", ".", "fresh_index", "."...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.buffer
Add a sequence of documents to be processed (indexed or trained on). Here, the documents are simply collected; real processing is done later, during the `self.index` or `self.train` calls. `buffer` can be called repeatedly; the result is the same as if it was called once, with a concat...
simserver/simserver.py
def buffer(self, documents): """ Add a sequence of documents to be processed (indexed or trained on). Here, the documents are simply collected; real processing is done later, during the `self.index` or `self.train` calls. `buffer` can be called repeatedly; the result is the sam...
def buffer(self, documents): """ Add a sequence of documents to be processed (indexed or trained on). Here, the documents are simply collected; real processing is done later, during the `self.index` or `self.train` calls. `buffer` can be called repeatedly; the result is the sam...
[ "Add", "a", "sequence", "of", "documents", "to", "be", "processed", "(", "indexed", "or", "trained", "on", ")", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L530-L552
[ "def", "buffer", "(", "self", ",", "documents", ")", ":", "logger", ".", "info", "(", "\"adding documents to temporary buffer of %s\"", "%", "(", "self", ")", ")", "for", "doc", "in", "documents", ":", "docid", "=", "doc", "[", "'id'", "]", "# log...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.train
Create an indexing model. Will overwrite the model if it already exists. All indexes become invalid, because documents in them use a now-obsolete representation. The model is trained on documents previously entered via `buffer`, or directly on `corpus`, if specified.
simserver/simserver.py
def train(self, corpus=None, method='auto', clear_buffer=True, params=None): """ Create an indexing model. Will overwrite the model if it already exists. All indexes become invalid, because documents in them use a now-obsolete representation. The model is trained on documents pr...
def train(self, corpus=None, method='auto', clear_buffer=True, params=None): """ Create an indexing model. Will overwrite the model if it already exists. All indexes become invalid, because documents in them use a now-obsolete representation. The model is trained on documents pr...
[ "Create", "an", "indexing", "model", ".", "Will", "overwrite", "the", "model", "if", "it", "already", "exists", ".", "All", "indexes", "become", "invalid", "because", "documents", "in", "them", "use", "a", "now", "-", "obsolete", "representation", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L556-L583
[ "def", "train", "(", "self", ",", "corpus", "=", "None", ",", "method", "=", "'auto'", ",", "clear_buffer", "=", "True", ",", "params", "=", "None", ")", ":", "if", "corpus", "is", "not", "None", ":", "# use the supplied corpus only (erase existing buffer, if ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.index
Permanently index all documents previously added via `buffer`, or directly index documents from `corpus`, if specified. The indexing model must already exist (see `train`) before this function is called.
simserver/simserver.py
def index(self, corpus=None, clear_buffer=True): """ Permanently index all documents previously added via `buffer`, or directly index documents from `corpus`, if specified. The indexing model must already exist (see `train`) before this function is called. """ if...
def index(self, corpus=None, clear_buffer=True): """ Permanently index all documents previously added via `buffer`, or directly index documents from `corpus`, if specified. The indexing model must already exist (see `train`) before this function is called. """ if...
[ "Permanently", "index", "all", "documents", "previously", "added", "via", "buffer", "or", "directly", "index", "documents", "from", "corpus", "if", "specified", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L587-L623
[ "def", "index", "(", "self", ",", "corpus", "=", "None", ",", "clear_buffer", "=", "True", ")", ":", "if", "not", "self", ".", "model", ":", "msg", "=", "'must initialize model for %s before indexing documents'", "%", "self", ".", "basename", "logger", ".", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.optimize
Precompute top similarities for all indexed documents. This speeds up `find_similar` queries by id (but not queries by fulltext). Internally, documents are moved from a fresh index (=no precomputed similarities) to an optimized index (precomputed similarities). Similarity queries always ...
simserver/simserver.py
def optimize(self): """ Precompute top similarities for all indexed documents. This speeds up `find_similar` queries by id (but not queries by fulltext). Internally, documents are moved from a fresh index (=no precomputed similarities) to an optimized index (precomputed similari...
def optimize(self): """ Precompute top similarities for all indexed documents. This speeds up `find_similar` queries by id (but not queries by fulltext). Internally, documents are moved from a fresh index (=no precomputed similarities) to an optimized index (precomputed similari...
[ "Precompute", "top", "similarities", "for", "all", "indexed", "documents", ".", "This", "speeds", "up", "find_similar", "queries", "by", "id", "(", "but", "not", "queries", "by", "fulltext", ")", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L627-L652
[ "def", "optimize", "(", "self", ")", ":", "if", "self", ".", "fresh_index", "is", "None", ":", "logger", ".", "warning", "(", "\"optimize called but there are no new documents\"", ")", "return", "# nothing to do!", "if", "self", ".", "opt_index", "is", "None", "...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.drop_index
Drop all indexed documents. If `keep_model` is False, also dropped the model.
simserver/simserver.py
def drop_index(self, keep_model=True): """Drop all indexed documents. If `keep_model` is False, also dropped the model.""" modelstr = "" if keep_model else "and model " logger.info("deleting similarity index " + modelstr + "from %s" % self.basename) # delete indexes for index in...
def drop_index(self, keep_model=True): """Drop all indexed documents. If `keep_model` is False, also dropped the model.""" modelstr = "" if keep_model else "and model " logger.info("deleting similarity index " + modelstr + "from %s" % self.basename) # delete indexes for index in...
[ "Drop", "all", "indexed", "documents", ".", "If", "keep_model", "is", "False", "also", "dropped", "the", "model", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L656-L691
[ "def", "drop_index", "(", "self", ",", "keep_model", "=", "True", ")", ":", "modelstr", "=", "\"\"", "if", "keep_model", "else", "\"and model \"", "logger", ".", "info", "(", "\"deleting similarity index \"", "+", "modelstr", "+", "\"from %s\"", "%", "self", "...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.delete
Delete specified documents from the index.
simserver/simserver.py
def delete(self, docids): """Delete specified documents from the index.""" logger.info("asked to drop %i documents" % len(docids)) for index in [self.opt_index, self.fresh_index]: if index is not None: index.delete(docids) self.flush(save_index=True)
def delete(self, docids): """Delete specified documents from the index.""" logger.info("asked to drop %i documents" % len(docids)) for index in [self.opt_index, self.fresh_index]: if index is not None: index.delete(docids) self.flush(save_index=True)
[ "Delete", "specified", "documents", "from", "the", "index", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L695-L701
[ "def", "delete", "(", "self", ",", "docids", ")", ":", "logger", ".", "info", "(", "\"asked to drop %i documents\"", "%", "len", "(", "docids", ")", ")", "for", "index", "in", "[", "self", ".", "opt_index", ",", "self", ".", "fresh_index", "]", ":", "i...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.find_similar
Find `max_results` most similar articles in the index, each having similarity score of at least `min_score`. The resulting list may be shorter than `max_results`, in case there are not enough matching documents. `doc` is either a string (=document id, previously indexed) or a dict conta...
simserver/simserver.py
def find_similar(self, doc, min_score=0.0, max_results=100): """ Find `max_results` most similar articles in the index, each having similarity score of at least `min_score`. The resulting list may be shorter than `max_results`, in case there are not enough matching documents. `d...
def find_similar(self, doc, min_score=0.0, max_results=100): """ Find `max_results` most similar articles in the index, each having similarity score of at least `min_score`. The resulting list may be shorter than `max_results`, in case there are not enough matching documents. `d...
[ "Find", "max_results", "most", "similar", "articles", "in", "the", "index", "each", "having", "similarity", "score", "of", "at", "least", "min_score", ".", "The", "resulting", "list", "may", "be", "shorter", "than", "max_results", "in", "case", "there", "are",...
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L714-L773
[ "def", "find_similar", "(", "self", ",", "doc", ",", "min_score", "=", "0.0", ",", "max_results", "=", "100", ")", ":", "logger", ".", "debug", "(", "\"received query call with %r\"", "%", "doc", ")", "if", "self", ".", "is_locked", "(", ")", ":", "msg",...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SimServer.keys
Return ids of all indexed documents.
simserver/simserver.py
def keys(self): """Return ids of all indexed documents.""" result = [] if self.fresh_index is not None: result += self.fresh_index.keys() if self.opt_index is not None: result += self.opt_index.keys() return result
def keys(self): """Return ids of all indexed documents.""" result = [] if self.fresh_index is not None: result += self.fresh_index.keys() if self.opt_index is not None: result += self.opt_index.keys() return result
[ "Return", "ids", "of", "all", "indexed", "documents", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L799-L806
[ "def", "keys", "(", "self", ")", ":", "result", "=", "[", "]", "if", "self", ".", "fresh_index", "is", "not", "None", ":", "result", "+=", "self", ".", "fresh_index", ".", "keys", "(", ")", "if", "self", ".", "opt_index", "is", "not", "None", ":", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.check_session
Make sure a session is open. If it's not and autosession is turned on, create a new session automatically. If it's not and autosession is off, raise an exception.
simserver/simserver.py
def check_session(self): """ Make sure a session is open. If it's not and autosession is turned on, create a new session automatically. If it's not and autosession is off, raise an exception. """ if self.session is None: if self.autosession: s...
def check_session(self): """ Make sure a session is open. If it's not and autosession is turned on, create a new session automatically. If it's not and autosession is off, raise an exception. """ if self.session is None: if self.autosession: s...
[ "Make", "sure", "a", "session", "is", "open", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L876-L888
[ "def", "check_session", "(", "self", ")", ":", "if", "self", ".", "session", "is", "None", ":", "if", "self", ".", "autosession", ":", "self", ".", "open_session", "(", ")", "else", ":", "msg", "=", "\"must open a session before modifying %s\"", "%", "self",...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.open_session
Open a new session to modify this server. You can either call this fnc directly, or turn on autosession which will open/commit sessions for you transparently.
simserver/simserver.py
def open_session(self): """ Open a new session to modify this server. You can either call this fnc directly, or turn on autosession which will open/commit sessions for you transparently. """ if self.session is not None: msg = "session already open; commit it ...
def open_session(self): """ Open a new session to modify this server. You can either call this fnc directly, or turn on autosession which will open/commit sessions for you transparently. """ if self.session is not None: msg = "session already open; commit it ...
[ "Open", "a", "new", "session", "to", "modify", "this", "server", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L891-L913
[ "def", "open_session", "(", "self", ")", ":", "if", "self", ".", "session", "is", "not", "None", ":", "msg", "=", "\"session already open; commit it or rollback before opening another one in %s\"", "%", "self", "logger", ".", "error", "(", "msg", ")", "raise", "Ru...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.buffer
Buffer documents, in the current session
simserver/simserver.py
def buffer(self, *args, **kwargs): """Buffer documents, in the current session""" self.check_session() result = self.session.buffer(*args, **kwargs) return result
def buffer(self, *args, **kwargs): """Buffer documents, in the current session""" self.check_session() result = self.session.buffer(*args, **kwargs) return result
[ "Buffer", "documents", "in", "the", "current", "session" ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L916-L920
[ "def", "buffer", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "buffer", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "result" ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.index
Index documents, in the current session
simserver/simserver.py
def index(self, *args, **kwargs): """Index documents, in the current session""" self.check_session() result = self.session.index(*args, **kwargs) if self.autosession: self.commit() return result
def index(self, *args, **kwargs): """Index documents, in the current session""" self.check_session() result = self.session.index(*args, **kwargs) if self.autosession: self.commit() return result
[ "Index", "documents", "in", "the", "current", "session" ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L923-L929
[ "def", "index", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "index", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "self", ".", "a...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.drop_index
Drop all indexed documents from the session. Optionally, drop model too.
simserver/simserver.py
def drop_index(self, keep_model=True): """Drop all indexed documents from the session. Optionally, drop model too.""" self.check_session() result = self.session.drop_index(keep_model) if self.autosession: self.commit() return result
def drop_index(self, keep_model=True): """Drop all indexed documents from the session. Optionally, drop model too.""" self.check_session() result = self.session.drop_index(keep_model) if self.autosession: self.commit() return result
[ "Drop", "all", "indexed", "documents", "from", "the", "session", ".", "Optionally", "drop", "model", "too", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L941-L947
[ "def", "drop_index", "(", "self", ",", "keep_model", "=", "True", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "drop_index", "(", "keep_model", ")", "if", "self", ".", "autosession", ":", "self", ".", "c...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.delete
Delete documents from the current session.
simserver/simserver.py
def delete(self, docids): """Delete documents from the current session.""" self.check_session() result = self.session.delete(docids) if self.autosession: self.commit() return result
def delete(self, docids): """Delete documents from the current session.""" self.check_session() result = self.session.delete(docids) if self.autosession: self.commit() return result
[ "Delete", "documents", "from", "the", "current", "session", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L950-L956
[ "def", "delete", "(", "self", ",", "docids", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "delete", "(", "docids", ")", "if", "self", ".", "autosession", ":", "self", ".", "commit", "(", ")", "return",...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.optimize
Optimize index for faster by-document-id queries.
simserver/simserver.py
def optimize(self): """Optimize index for faster by-document-id queries.""" self.check_session() result = self.session.optimize() if self.autosession: self.commit() return result
def optimize(self): """Optimize index for faster by-document-id queries.""" self.check_session() result = self.session.optimize() if self.autosession: self.commit() return result
[ "Optimize", "index", "for", "faster", "by", "-", "document", "-", "id", "queries", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L959-L965
[ "def", "optimize", "(", "self", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "optimize", "(", ")", "if", "self", ".", "autosession", ":", "self", ".", "commit", "(", ")", "return", "result" ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.commit
Commit changes made by the latest session.
simserver/simserver.py
def commit(self): """Commit changes made by the latest session.""" if self.session is not None: logger.info("committing transaction in %s" % self) tmp = self.stable self.stable, self.session = self.session, None self.istable = 1 - self.istable ...
def commit(self): """Commit changes made by the latest session.""" if self.session is not None: logger.info("committing transaction in %s" % self) tmp = self.stable self.stable, self.session = self.session, None self.istable = 1 - self.istable ...
[ "Commit", "changes", "made", "by", "the", "latest", "session", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L973-L984
[ "def", "commit", "(", "self", ")", ":", "if", "self", ".", "session", "is", "not", "None", ":", "logger", ".", "info", "(", "\"committing transaction in %s\"", "%", "self", ")", "tmp", "=", "self", ".", "stable", "self", ".", "stable", ",", "self", "."...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.rollback
Ignore all changes made in the latest session (terminate the session).
simserver/simserver.py
def rollback(self): """Ignore all changes made in the latest session (terminate the session).""" if self.session is not None: logger.info("rolling back transaction in %s" % self) self.session.close() self.session = None self.lock_update.release() e...
def rollback(self): """Ignore all changes made in the latest session (terminate the session).""" if self.session is not None: logger.info("rolling back transaction in %s" % self) self.session.close() self.session = None self.lock_update.release() e...
[ "Ignore", "all", "changes", "made", "in", "the", "latest", "session", "(", "terminate", "the", "session", ")", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L987-L995
[ "def", "rollback", "(", "self", ")", ":", "if", "self", ".", "session", "is", "not", "None", ":", "logger", ".", "info", "(", "\"rolling back transaction in %s\"", "%", "self", ")", "self", ".", "session", ".", "close", "(", ")", "self", ".", "session", ...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.set_autosession
Turn autosession (automatic committing after each modification call) on/off. If value is None, only query the current value (don't change anything).
simserver/simserver.py
def set_autosession(self, value=None): """ Turn autosession (automatic committing after each modification call) on/off. If value is None, only query the current value (don't change anything). """ if value is not None: self.rollback() self.autosession = val...
def set_autosession(self, value=None): """ Turn autosession (automatic committing after each modification call) on/off. If value is None, only query the current value (don't change anything). """ if value is not None: self.rollback() self.autosession = val...
[ "Turn", "autosession", "(", "automatic", "committing", "after", "each", "modification", "call", ")", "on", "/", "off", ".", "If", "value", "is", "None", "only", "query", "the", "current", "value", "(", "don", "t", "change", "anything", ")", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L998-L1006
[ "def", "set_autosession", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "self", ".", "rollback", "(", ")", "self", ".", "autosession", "=", "value", "return", "self", ".", "autosession" ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.terminate
Delete all files created by this server, invalidating `self`. Use with care.
simserver/simserver.py
def terminate(self): """Delete all files created by this server, invalidating `self`. Use with care.""" logger.info("deleting entire server %s" % self) self.close() try: shutil.rmtree(self.basedir) logger.info("deleted server under %s" % self.basedir) ...
def terminate(self): """Delete all files created by this server, invalidating `self`. Use with care.""" logger.info("deleting entire server %s" % self) self.close() try: shutil.rmtree(self.basedir) logger.info("deleted server under %s" % self.basedir) ...
[ "Delete", "all", "files", "created", "by", "this", "server", "invalidating", "self", ".", "Use", "with", "care", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L1024-L1039
[ "def", "terminate", "(", "self", ")", ":", "logger", ".", "info", "(", "\"deleting entire server %s\"", "%", "self", ")", "self", ".", "close", "(", ")", "try", ":", "shutil", ".", "rmtree", "(", "self", ".", "basedir", ")", "logger", ".", "info", "(",...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
SessionServer.find_similar
Find similar articles. With autosession off, use the index state *before* current session started, so that changes made in the session will not be visible here. With autosession on, close the current session first (so that session changes *are* committed and visible).
simserver/simserver.py
def find_similar(self, *args, **kwargs): """ Find similar articles. With autosession off, use the index state *before* current session started, so that changes made in the session will not be visible here. With autosession on, close the current session first (so that session cha...
def find_similar(self, *args, **kwargs): """ Find similar articles. With autosession off, use the index state *before* current session started, so that changes made in the session will not be visible here. With autosession on, close the current session first (so that session cha...
[ "Find", "similar", "articles", "." ]
RaRe-Technologies/gensim-simserver
python
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L1042-L1054
[ "def", "find_similar", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "session", "is", "not", "None", "and", "self", ".", "autosession", ":", "# with autosession on, commit the pending transaction first", "self", ".", "com...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
train
Fortnite.profile
Fetch a profile.
examples/discord.py
async def profile(self, ctx, platform, name): '''Fetch a profile.''' player = await self.client.get_player(platform, name) solos = await player.get_solos() await ctx.send("# of kills in solos for {}: {}".format(name,solos.kills.value))
async def profile(self, ctx, platform, name): '''Fetch a profile.''' player = await self.client.get_player(platform, name) solos = await player.get_solos() await ctx.send("# of kills in solos for {}: {}".format(name,solos.kills.value))
[ "Fetch", "a", "profile", "." ]
cree-py/pynite
python
https://github.com/cree-py/pynite/blob/91424c912a23d2b93bda1f017703e492572134c6/examples/discord.py#L22-L28
[ "async", "def", "profile", "(", "self", ",", "ctx", ",", "platform", ",", "name", ")", ":", "player", "=", "await", "self", ".", "client", ".", "get_player", "(", "platform", ",", "name", ")", "solos", "=", "await", "player", ".", "get_solos", "(", "...
91424c912a23d2b93bda1f017703e492572134c6
train
start
Begins watching source files for changes. .. versionchanged:: 4.1 The ``io_loop`` argument is deprecated.
src/aiohttp_autoreload.py
def start(io_loop=None, check_time=2): """Begins watching source files for changes. .. versionchanged:: 4.1 The ``io_loop`` argument is deprecated. """ io_loop = io_loop or asyncio.get_event_loop() if io_loop in _io_loops: return _io_loops[io_loop] = True if len(_io_loops) >...
def start(io_loop=None, check_time=2): """Begins watching source files for changes. .. versionchanged:: 4.1 The ``io_loop`` argument is deprecated. """ io_loop = io_loop or asyncio.get_event_loop() if io_loop in _io_loops: return _io_loops[io_loop] = True if len(_io_loops) >...
[ "Begins", "watching", "source", "files", "for", "changes", "." ]
anti1869/aiohttp_autoreload
python
https://github.com/anti1869/aiohttp_autoreload/blob/1d9b9b67ffba1073fa35495d87538b4570807367/src/aiohttp_autoreload.py#L58-L76
[ "def", "start", "(", "io_loop", "=", "None", ",", "check_time", "=", "2", ")", ":", "io_loop", "=", "io_loop", "or", "asyncio", ".", "get_event_loop", "(", ")", "if", "io_loop", "in", "_io_loops", ":", "return", "_io_loops", "[", "io_loop", "]", "=", "...
1d9b9b67ffba1073fa35495d87538b4570807367
train
generate_chunks
Yield 'chunk_size' items from 'data' at a time.
efilter/protocols/reducer.py
def generate_chunks(data, chunk_size=DEFAULT_CHUNK_SIZE): """Yield 'chunk_size' items from 'data' at a time.""" iterator = iter(repeated.getvalues(data)) while True: chunk = list(itertools.islice(iterator, chunk_size)) if not chunk: return yield chunk
def generate_chunks(data, chunk_size=DEFAULT_CHUNK_SIZE): """Yield 'chunk_size' items from 'data' at a time.""" iterator = iter(repeated.getvalues(data)) while True: chunk = list(itertools.islice(iterator, chunk_size)) if not chunk: return yield chunk
[ "Yield", "chunk_size", "items", "from", "data", "at", "a", "time", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/protocols/reducer.py#L58-L67
[ "def", "generate_chunks", "(", "data", ",", "chunk_size", "=", "DEFAULT_CHUNK_SIZE", ")", ":", "iterator", "=", "iter", "(", "repeated", ".", "getvalues", "(", "data", ")", ")", "while", "True", ":", "chunk", "=", "list", "(", "itertools", ".", "islice", ...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
reduce
Repeatedly call fold and merge on data and then finalize. Arguments: data: Input for the fold function. reducer: The IReducer to use. chunk_size: How many items should be passed to fold at a time? Returns: Return value of finalize.
efilter/protocols/reducer.py
def reduce(reducer, data, chunk_size=DEFAULT_CHUNK_SIZE): """Repeatedly call fold and merge on data and then finalize. Arguments: data: Input for the fold function. reducer: The IReducer to use. chunk_size: How many items should be passed to fold at a time? Returns: Return ...
def reduce(reducer, data, chunk_size=DEFAULT_CHUNK_SIZE): """Repeatedly call fold and merge on data and then finalize. Arguments: data: Input for the fold function. reducer: The IReducer to use. chunk_size: How many items should be passed to fold at a time? Returns: Return ...
[ "Repeatedly", "call", "fold", "and", "merge", "on", "data", "and", "then", "finalize", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/protocols/reducer.py#L70-L92
[ "def", "reduce", "(", "reducer", ",", "data", ",", "chunk_size", "=", "DEFAULT_CHUNK_SIZE", ")", ":", "if", "not", "chunk_size", ":", "return", "finalize", "(", "reducer", ",", "fold", "(", "reducer", ",", "data", ")", ")", "# Splitting the work up into chunks...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
IfElse.conditions
The if-else pairs.
efilter/ast.py
def conditions(self): """The if-else pairs.""" for idx in six.moves.range(1, len(self.children), 2): yield (self.children[idx - 1], self.children[idx])
def conditions(self): """The if-else pairs.""" for idx in six.moves.range(1, len(self.children), 2): yield (self.children[idx - 1], self.children[idx])
[ "The", "if", "-", "else", "pairs", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/ast.py#L415-L418
[ "def", "conditions", "(", "self", ")", ":", "for", "idx", "in", "six", ".", "moves", ".", "range", "(", "1", ",", "len", "(", "self", ".", "children", ")", ",", "2", ")", ":", "yield", "(", "self", ".", "children", "[", "idx", "-", "1", "]", ...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
resolve_placeholders
**Purpose**: Substitute placeholders in staging attributes of a Task with actual paths to the corresponding tasks. :arguments: :path: string describing the staging paths, possibly containing a placeholder :placeholder_dict: dictionary holding the values for placeholders
src/radical/entk/execman/rp/task_processor.py
def resolve_placeholders(path, placeholder_dict): """ **Purpose**: Substitute placeholders in staging attributes of a Task with actual paths to the corresponding tasks. :arguments: :path: string describing the staging paths, possibly containing a placeholder :placeholder_dict: dictionary ho...
def resolve_placeholders(path, placeholder_dict): """ **Purpose**: Substitute placeholders in staging attributes of a Task with actual paths to the corresponding tasks. :arguments: :path: string describing the staging paths, possibly containing a placeholder :placeholder_dict: dictionary ho...
[ "**", "Purpose", "**", ":", "Substitute", "placeholders", "in", "staging", "attributes", "of", "a", "Task", "with", "actual", "paths", "to", "the", "corresponding", "tasks", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L10-L91
[ "def", "resolve_placeholders", "(", "path", ",", "placeholder_dict", ")", ":", "try", ":", "if", "isinstance", "(", "path", ",", "unicode", ")", ":", "path", "=", "str", "(", "path", ")", "if", "not", "isinstance", "(", "path", ",", "str", ")", ":", ...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
get_input_list_from_task
Purpose: Parse a Task object to extract the files to be staged as the output. Details: The extracted data is then converted into the appropriate RP directive depending on whether the data is to be copied/downloaded. :arguments: :task: EnTK Task object :placeholder_dict: dictionary holding ...
src/radical/entk/execman/rp/task_processor.py
def get_input_list_from_task(task, placeholder_dict): """ Purpose: Parse a Task object to extract the files to be staged as the output. Details: The extracted data is then converted into the appropriate RP directive depending on whether the data is to be copied/downloaded. :arguments: :tas...
def get_input_list_from_task(task, placeholder_dict): """ Purpose: Parse a Task object to extract the files to be staged as the output. Details: The extracted data is then converted into the appropriate RP directive depending on whether the data is to be copied/downloaded. :arguments: :tas...
[ "Purpose", ":", "Parse", "a", "Task", "object", "to", "extract", "the", "files", "to", "be", "staged", "as", "the", "output", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L156-L265
[ "def", "get_input_list_from_task", "(", "task", ",", "placeholder_dict", ")", ":", "try", ":", "if", "not", "isinstance", "(", "task", ",", "Task", ")", ":", "raise", "TypeError", "(", "expected_type", "=", "Task", ",", "actual_type", "=", "type", "(", "ta...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
get_output_list_from_task
Purpose: Parse a Task object to extract the files to be staged as the output. Details: The extracted data is then converted into the appropriate RP directive depending on whether the data is to be copied/downloaded. :arguments: :task: EnTK Task object :placeholder_dict: dictionary holding ...
src/radical/entk/execman/rp/task_processor.py
def get_output_list_from_task(task, placeholder_dict): """ Purpose: Parse a Task object to extract the files to be staged as the output. Details: The extracted data is then converted into the appropriate RP directive depending on whether the data is to be copied/downloaded. :arguments: :ta...
def get_output_list_from_task(task, placeholder_dict): """ Purpose: Parse a Task object to extract the files to be staged as the output. Details: The extracted data is then converted into the appropriate RP directive depending on whether the data is to be copied/downloaded. :arguments: :ta...
[ "Purpose", ":", "Parse", "a", "Task", "object", "to", "extract", "the", "files", "to", "be", "staged", "as", "the", "output", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L268-L357
[ "def", "get_output_list_from_task", "(", "task", ",", "placeholder_dict", ")", ":", "try", ":", "if", "not", "isinstance", "(", "task", ",", "Task", ")", ":", "raise", "TypeError", "(", "expected_type", "=", "Task", ",", "actual_type", "=", "type", "(", "t...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
create_cud_from_task
Purpose: Create a Compute Unit description based on the defined Task. :arguments: :task: EnTK Task object :placeholder_dict: dictionary holding the values for placeholders :return: ComputeUnitDescription
src/radical/entk/execman/rp/task_processor.py
def create_cud_from_task(task, placeholder_dict, prof=None): """ Purpose: Create a Compute Unit description based on the defined Task. :arguments: :task: EnTK Task object :placeholder_dict: dictionary holding the values for placeholders :return: ComputeUnitDescription """ try:...
def create_cud_from_task(task, placeholder_dict, prof=None): """ Purpose: Create a Compute Unit description based on the defined Task. :arguments: :task: EnTK Task object :placeholder_dict: dictionary holding the values for placeholders :return: ComputeUnitDescription """ try:...
[ "Purpose", ":", "Create", "a", "Compute", "Unit", "description", "based", "on", "the", "defined", "Task", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L360-L420
[ "def", "create_cud_from_task", "(", "task", ",", "placeholder_dict", ",", "prof", "=", "None", ")", ":", "try", ":", "logger", ".", "debug", "(", "'Creating CU from Task %s'", "%", "(", "task", ".", "uid", ")", ")", "if", "prof", ":", "prof", ".", "prof"...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
create_task_from_cu
Purpose: Create a Task based on the Compute Unit. Details: Currently, only the uid, parent_stage and parent_pipeline are retrieved. The exact initial Task (that was converted to a CUD) cannot be recovered as the RP API does not provide the same attributes for a CU as for a CUD. Also, this is not required f...
src/radical/entk/execman/rp/task_processor.py
def create_task_from_cu(cu, prof=None): """ Purpose: Create a Task based on the Compute Unit. Details: Currently, only the uid, parent_stage and parent_pipeline are retrieved. The exact initial Task (that was converted to a CUD) cannot be recovered as the RP API does not provide the same attributes for...
def create_task_from_cu(cu, prof=None): """ Purpose: Create a Task based on the Compute Unit. Details: Currently, only the uid, parent_stage and parent_pipeline are retrieved. The exact initial Task (that was converted to a CUD) cannot be recovered as the RP API does not provide the same attributes for...
[ "Purpose", ":", "Create", "a", "Task", "based", "on", "the", "Compute", "Unit", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L423-L472
[ "def", "create_task_from_cu", "(", "cu", ",", "prof", "=", "None", ")", ":", "try", ":", "logger", ".", "debug", "(", "'Create Task from CU %s'", "%", "cu", ".", "name", ")", "if", "prof", ":", "prof", ".", "prof", "(", "'task from cu - create'", ",", "u...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Command.handle_noargs
Send Report E-mails.
redis_metrics/management/commands/redis_metrics_send_mail.py
def handle_noargs(self, **options): """Send Report E-mails.""" r = get_r() since = datetime.utcnow() - timedelta(days=1) metrics = {} categories = r.metric_slugs_by_category() for category_name, slug_list in categories.items(): metrics[category_name] = [] ...
def handle_noargs(self, **options): """Send Report E-mails.""" r = get_r() since = datetime.utcnow() - timedelta(days=1) metrics = {} categories = r.metric_slugs_by_category() for category_name, slug_list in categories.items(): metrics[category_name] = [] ...
[ "Send", "Report", "E", "-", "mails", "." ]
bradmontgomery/django-redis-metrics
python
https://github.com/bradmontgomery/django-redis-metrics/blob/2c92332920113d28c39234b949aa496b39a091d1/redis_metrics/management/commands/redis_metrics_send_mail.py#L16-L54
[ "def", "handle_noargs", "(", "self", ",", "*", "*", "options", ")", ":", "r", "=", "get_r", "(", ")", "since", "=", "datetime", ".", "utcnow", "(", ")", "-", "timedelta", "(", "days", "=", "1", ")", "metrics", "=", "{", "}", "categories", "=", "r...
2c92332920113d28c39234b949aa496b39a091d1
train
Stage.luid
Unique ID of the current stage (fully qualified). example: >>> stage.luid pipe.0001.stage.0004 :getter: Returns the fully qualified uid of the current stage :type: String
src/radical/entk/stage/stage.py
def luid(self): """ Unique ID of the current stage (fully qualified). example: >>> stage.luid pipe.0001.stage.0004 :getter: Returns the fully qualified uid of the current stage :type: String """ p_elem = self.parent_pipeline.get('name') ...
def luid(self): """ Unique ID of the current stage (fully qualified). example: >>> stage.luid pipe.0001.stage.0004 :getter: Returns the fully qualified uid of the current stage :type: String """ p_elem = self.parent_pipeline.get('name') ...
[ "Unique", "ID", "of", "the", "current", "stage", "(", "fully", "qualified", ")", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L92-L111
[ "def", "luid", "(", "self", ")", ":", "p_elem", "=", "self", ".", "parent_pipeline", ".", "get", "(", "'name'", ")", "if", "not", "p_elem", ":", "p_elem", "=", "self", ".", "parent_pipeline", "[", "'uid'", "]", "s_elem", "=", "self", ".", "name", "if...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage.add_tasks
Adds tasks to the existing set of tasks of the Stage :argument: set of tasks
src/radical/entk/stage/stage.py
def add_tasks(self, value): """ Adds tasks to the existing set of tasks of the Stage :argument: set of tasks """ tasks = self._validate_entities(value) self._tasks.update(tasks) self._task_count = len(self._tasks)
def add_tasks(self, value): """ Adds tasks to the existing set of tasks of the Stage :argument: set of tasks """ tasks = self._validate_entities(value) self._tasks.update(tasks) self._task_count = len(self._tasks)
[ "Adds", "tasks", "to", "the", "existing", "set", "of", "tasks", "of", "the", "Stage" ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L201-L209
[ "def", "add_tasks", "(", "self", ",", "value", ")", ":", "tasks", "=", "self", ".", "_validate_entities", "(", "value", ")", "self", ".", "_tasks", ".", "update", "(", "tasks", ")", "self", ".", "_task_count", "=", "len", "(", "self", ".", "_tasks", ...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage.to_dict
Convert current Stage into a dictionary :return: python dictionary
src/radical/entk/stage/stage.py
def to_dict(self): """ Convert current Stage into a dictionary :return: python dictionary """ stage_desc_as_dict = { 'uid': self._uid, 'name': self._name, 'state': self._state, 'state_history': self._state_history, 'p...
def to_dict(self): """ Convert current Stage into a dictionary :return: python dictionary """ stage_desc_as_dict = { 'uid': self._uid, 'name': self._name, 'state': self._state, 'state_history': self._state_history, 'p...
[ "Convert", "current", "Stage", "into", "a", "dictionary" ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L211-L227
[ "def", "to_dict", "(", "self", ")", ":", "stage_desc_as_dict", "=", "{", "'uid'", ":", "self", ".", "_uid", ",", "'name'", ":", "self", ".", "_name", ",", "'state'", ":", "self", ".", "_state", ",", "'state_history'", ":", "self", ".", "_state_history", ...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage.from_dict
Create a Stage from a dictionary. The change is in inplace. :argument: python dictionary :return: None
src/radical/entk/stage/stage.py
def from_dict(self, d): """ Create a Stage from a dictionary. The change is in inplace. :argument: python dictionary :return: None """ if 'uid' in d: if d['uid']: self._uid = d['uid'] if 'name' in d: if d['name']: ...
def from_dict(self, d): """ Create a Stage from a dictionary. The change is in inplace. :argument: python dictionary :return: None """ if 'uid' in d: if d['uid']: self._uid = d['uid'] if 'name' in d: if d['name']: ...
[ "Create", "a", "Stage", "from", "a", "dictionary", ".", "The", "change", "is", "in", "inplace", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L229-L270
[ "def", "from_dict", "(", "self", ",", "d", ")", ":", "if", "'uid'", "in", "d", ":", "if", "d", "[", "'uid'", "]", ":", "self", ".", "_uid", "=", "d", "[", "'uid'", "]", "if", "'name'", "in", "d", ":", "if", "d", "[", "'name'", "]", ":", "se...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage._set_tasks_state
Purpose: Set state of all tasks of the current stage. :arguments: String
src/radical/entk/stage/stage.py
def _set_tasks_state(self, value): """ Purpose: Set state of all tasks of the current stage. :arguments: String """ if value not in states.state_numbers.keys(): raise ValueError(obj=self._uid, attribute='set_tasks_state', ...
def _set_tasks_state(self, value): """ Purpose: Set state of all tasks of the current stage. :arguments: String """ if value not in states.state_numbers.keys(): raise ValueError(obj=self._uid, attribute='set_tasks_state', ...
[ "Purpose", ":", "Set", "state", "of", "all", "tasks", "of", "the", "current", "stage", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L276-L289
[ "def", "_set_tasks_state", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "states", ".", "state_numbers", ".", "keys", "(", ")", ":", "raise", "ValueError", "(", "obj", "=", "self", ".", "_uid", ",", "attribute", "=", "'set_tasks_state'...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage._check_stage_complete
Purpose: Check if all tasks of the current stage have completed, i.e., are in either DONE or FAILED state.
src/radical/entk/stage/stage.py
def _check_stage_complete(self): """ Purpose: Check if all tasks of the current stage have completed, i.e., are in either DONE or FAILED state. """ try: for task in self._tasks: if task.state not in [states.DONE, states.FAILED]: return Fa...
def _check_stage_complete(self): """ Purpose: Check if all tasks of the current stage have completed, i.e., are in either DONE or FAILED state. """ try: for task in self._tasks: if task.state not in [states.DONE, states.FAILED]: return Fa...
[ "Purpose", ":", "Check", "if", "all", "tasks", "of", "the", "current", "stage", "have", "completed", "i", ".", "e", ".", "are", "in", "either", "DONE", "or", "FAILED", "state", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L291-L305
[ "def", "_check_stage_complete", "(", "self", ")", ":", "try", ":", "for", "task", "in", "self", ".", "_tasks", ":", "if", "task", ".", "state", "not", "in", "[", "states", ".", "DONE", ",", "states", ".", "FAILED", "]", ":", "return", "False", "retur...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage._validate_entities
Purpose: Validate whether the 'tasks' is of type set. Validate the description of each Task.
src/radical/entk/stage/stage.py
def _validate_entities(self, tasks): """ Purpose: Validate whether the 'tasks' is of type set. Validate the description of each Task. """ if not tasks: raise TypeError(expected_type=Task, actual_type=type(tasks)) if not isinstance(tasks, set): if not is...
def _validate_entities(self, tasks): """ Purpose: Validate whether the 'tasks' is of type set. Validate the description of each Task. """ if not tasks: raise TypeError(expected_type=Task, actual_type=type(tasks)) if not isinstance(tasks, set): if not is...
[ "Purpose", ":", "Validate", "whether", "the", "tasks", "is", "of", "type", "set", ".", "Validate", "the", "description", "of", "each", "Task", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L308-L328
[ "def", "_validate_entities", "(", "self", ",", "tasks", ")", ":", "if", "not", "tasks", ":", "raise", "TypeError", "(", "expected_type", "=", "Task", ",", "actual_type", "=", "type", "(", "tasks", ")", ")", "if", "not", "isinstance", "(", "tasks", ",", ...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage._assign_uid
Purpose: Assign a uid to the current object based on the sid passed. Pass the current uid to children of current object
src/radical/entk/stage/stage.py
def _assign_uid(self, sid): """ Purpose: Assign a uid to the current object based on the sid passed. Pass the current uid to children of current object """ self._uid = ru.generate_id('stage.%(item_counter)04d', ru.ID_CUSTOM, namespace=sid) for task in self._tasks: ...
def _assign_uid(self, sid): """ Purpose: Assign a uid to the current object based on the sid passed. Pass the current uid to children of current object """ self._uid = ru.generate_id('stage.%(item_counter)04d', ru.ID_CUSTOM, namespace=sid) for task in self._tasks: ...
[ "Purpose", ":", "Assign", "a", "uid", "to", "the", "current", "object", "based", "on", "the", "sid", "passed", ".", "Pass", "the", "current", "uid", "to", "children", "of", "current", "object" ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L351-L360
[ "def", "_assign_uid", "(", "self", ",", "sid", ")", ":", "self", ".", "_uid", "=", "ru", ".", "generate_id", "(", "'stage.%(item_counter)04d'", ",", "ru", ".", "ID_CUSTOM", ",", "namespace", "=", "sid", ")", "for", "task", "in", "self", ".", "_tasks", ...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Stage._pass_uid
Purpose: Assign the parent Stage and the parent Pipeline to all the tasks of the current stage. :arguments: set of Tasks (optional) :return: list of updated Tasks
src/radical/entk/stage/stage.py
def _pass_uid(self): """ Purpose: Assign the parent Stage and the parent Pipeline to all the tasks of the current stage. :arguments: set of Tasks (optional) :return: list of updated Tasks """ for task in self._tasks: task.parent_stage['uid'] = self._uid ...
def _pass_uid(self): """ Purpose: Assign the parent Stage and the parent Pipeline to all the tasks of the current stage. :arguments: set of Tasks (optional) :return: list of updated Tasks """ for task in self._tasks: task.parent_stage['uid'] = self._uid ...
[ "Purpose", ":", "Assign", "the", "parent", "Stage", "and", "the", "parent", "Pipeline", "to", "all", "the", "tasks", "of", "the", "current", "stage", "." ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L362-L374
[ "def", "_pass_uid", "(", "self", ")", ":", "for", "task", "in", "self", ".", "_tasks", ":", "task", ".", "parent_stage", "[", "'uid'", "]", "=", "self", ".", "_uid", "task", ".", "parent_stage", "[", "'name'", "]", "=", "self", ".", "_name", "task", ...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
application
Matches function call (application).
efilter/parsers/dottysql/grammar.py
def application(tokens): """Matches function call (application).""" tokens = iter(tokens) func = next(tokens) paren = next(tokens) if func and func.name == "symbol" and paren.name == "lparen": # We would be able to unambiguously parse function application with # whitespace between t...
def application(tokens): """Matches function call (application).""" tokens = iter(tokens) func = next(tokens) paren = next(tokens) if func and func.name == "symbol" and paren.name == "lparen": # We would be able to unambiguously parse function application with # whitespace between t...
[ "Matches", "function", "call", "(", "application", ")", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/dottysql/grammar.py#L208-L223
[ "def", "application", "(", "tokens", ")", ":", "tokens", "=", "iter", "(", "tokens", ")", "func", "=", "next", "(", "tokens", ")", "paren", "=", "next", "(", "tokens", ")", "if", "func", "and", "func", ".", "name", "==", "\"symbol\"", "and", "paren",...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
BdistRPMCommand._make_spec_file
Generates the text of an RPM spec file. Returns: A list of strings containing the lines of text.
setup.py
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: A list of strings containing the lines of text. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, se...
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: A list of strings containing the lines of text. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, se...
[ "Generates", "the", "text", "of", "an", "RPM", "spec", "file", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/setup.py#L45-L105
[ "def", "_make_spec_file", "(", "self", ")", ":", "# Note that bdist_rpm can be an old style class.", "if", "issubclass", "(", "BdistRPMCommand", ",", "object", ")", ":", "spec_file", "=", "super", "(", "BdistRPMCommand", ",", "self", ")", ".", "_make_spec_file", "("...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ScopeStack.resolve
Call IStructured.resolve across all scopes and return first hit.
efilter/scope.py
def resolve(self, name): """Call IStructured.resolve across all scopes and return first hit.""" for scope in reversed(self.scopes): try: return structured.resolve(scope, name) except (KeyError, AttributeError): continue raise AttributeErro...
def resolve(self, name): """Call IStructured.resolve across all scopes and return first hit.""" for scope in reversed(self.scopes): try: return structured.resolve(scope, name) except (KeyError, AttributeError): continue raise AttributeErro...
[ "Call", "IStructured", ".", "resolve", "across", "all", "scopes", "and", "return", "first", "hit", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/scope.py#L73-L81
[ "def", "resolve", "(", "self", ",", "name", ")", ":", "for", "scope", "in", "reversed", "(", "self", ".", "scopes", ")", ":", "try", ":", "return", "structured", ".", "resolve", "(", "scope", ",", "name", ")", "except", "(", "KeyError", ",", "Attribu...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ScopeStack.getmembers
Gets members (vars) from all scopes, using both runtime and static. This method will attempt both static and runtime getmembers. This is the recommended way of getting available members. Returns: Set of available vars. Raises: NotImplementedError if any scope f...
efilter/scope.py
def getmembers(self): """Gets members (vars) from all scopes, using both runtime and static. This method will attempt both static and runtime getmembers. This is the recommended way of getting available members. Returns: Set of available vars. Raises: N...
def getmembers(self): """Gets members (vars) from all scopes, using both runtime and static. This method will attempt both static and runtime getmembers. This is the recommended way of getting available members. Returns: Set of available vars. Raises: N...
[ "Gets", "members", "(", "vars", ")", "from", "all", "scopes", "using", "both", "runtime", "and", "static", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/scope.py#L83-L102
[ "def", "getmembers", "(", "self", ")", ":", "names", "=", "set", "(", ")", "for", "scope", "in", "self", ".", "scopes", ":", "if", "isinstance", "(", "scope", ",", "type", ")", ":", "names", ".", "update", "(", "structured", ".", "getmembers_static", ...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ScopeStack.getmembers_runtime
Gets members (vars) from all scopes using ONLY runtime information. You most likely want to use ScopeStack.getmembers instead. Returns: Set of available vars. Raises: NotImplementedError if any scope fails to implement 'getmembers'.
efilter/scope.py
def getmembers_runtime(self): """Gets members (vars) from all scopes using ONLY runtime information. You most likely want to use ScopeStack.getmembers instead. Returns: Set of available vars. Raises: NotImplementedError if any scope fails to implement 'getmembe...
def getmembers_runtime(self): """Gets members (vars) from all scopes using ONLY runtime information. You most likely want to use ScopeStack.getmembers instead. Returns: Set of available vars. Raises: NotImplementedError if any scope fails to implement 'getmembe...
[ "Gets", "members", "(", "vars", ")", "from", "all", "scopes", "using", "ONLY", "runtime", "information", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/scope.py#L104-L119
[ "def", "getmembers_runtime", "(", "self", ")", ":", "names", "=", "set", "(", ")", "for", "scope", "in", "self", ".", "scopes", ":", "names", ".", "update", "(", "structured", ".", "getmembers_runtime", "(", "scope", ")", ")", "return", "names" ]
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ScopeStack.getmembers_static
Gets members (vars) from all scopes using ONLY static information. You most likely want to use ScopeStack.getmembers instead. Returns: Set of available vars. Raises: NotImplementedError if any scope fails to implement 'getmembers'.
efilter/scope.py
def getmembers_static(cls): """Gets members (vars) from all scopes using ONLY static information. You most likely want to use ScopeStack.getmembers instead. Returns: Set of available vars. Raises: NotImplementedError if any scope fails to implement 'getmembers'...
def getmembers_static(cls): """Gets members (vars) from all scopes using ONLY static information. You most likely want to use ScopeStack.getmembers instead. Returns: Set of available vars. Raises: NotImplementedError if any scope fails to implement 'getmembers'...
[ "Gets", "members", "(", "vars", ")", "from", "all", "scopes", "using", "ONLY", "static", "information", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/scope.py#L122-L137
[ "def", "getmembers_static", "(", "cls", ")", ":", "names", "=", "set", "(", ")", "for", "scope", "in", "cls", ".", "scopes", ":", "names", ".", "update", "(", "structured", ".", "getmembers_static", "(", "scope", ")", ")", "return", "names" ]
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ScopeStack.reflect
Reflect 'name' starting with local scope all the way up to global. This method will attempt both static and runtime reflection. This is the recommended way of using reflection. Returns: Type of 'name', or protocol.AnyType. Caveat: The type of 'name' does not ne...
efilter/scope.py
def reflect(self, name): """Reflect 'name' starting with local scope all the way up to global. This method will attempt both static and runtime reflection. This is the recommended way of using reflection. Returns: Type of 'name', or protocol.AnyType. Caveat: ...
def reflect(self, name): """Reflect 'name' starting with local scope all the way up to global. This method will attempt both static and runtime reflection. This is the recommended way of using reflection. Returns: Type of 'name', or protocol.AnyType. Caveat: ...
[ "Reflect", "name", "starting", "with", "local", "scope", "all", "the", "way", "up", "to", "global", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/scope.py#L139-L170
[ "def", "reflect", "(", "self", ",", "name", ")", ":", "# Return whatever the most local scope defines this as, or bubble all", "# the way to the top.", "result", "=", "None", "for", "scope", "in", "reversed", "(", "self", ".", "scopes", ")", ":", "try", ":", "if", ...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ScopeStack.reflect_runtime_member
Reflect 'name' using ONLY runtime reflection. You most likely want to use ScopeStack.reflect instead. Returns: Type of 'name', or protocol.AnyType.
efilter/scope.py
def reflect_runtime_member(self, name): """Reflect 'name' using ONLY runtime reflection. You most likely want to use ScopeStack.reflect instead. Returns: Type of 'name', or protocol.AnyType. """ for scope in reversed(self.scopes): try: re...
def reflect_runtime_member(self, name): """Reflect 'name' using ONLY runtime reflection. You most likely want to use ScopeStack.reflect instead. Returns: Type of 'name', or protocol.AnyType. """ for scope in reversed(self.scopes): try: re...
[ "Reflect", "name", "using", "ONLY", "runtime", "reflection", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/scope.py#L172-L186
[ "def", "reflect_runtime_member", "(", "self", ",", "name", ")", ":", "for", "scope", "in", "reversed", "(", "self", ".", "scopes", ")", ":", "try", ":", "return", "structured", ".", "reflect_runtime_member", "(", "scope", ",", "name", ")", "except", "(", ...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ScopeStack.reflect_static_member
Reflect 'name' using ONLY static reflection. You most likely want to use ScopeStack.reflect instead. Returns: Type of 'name', or protocol.AnyType.
efilter/scope.py
def reflect_static_member(cls, name): """Reflect 'name' using ONLY static reflection. You most likely want to use ScopeStack.reflect instead. Returns: Type of 'name', or protocol.AnyType. """ for scope in reversed(cls.scopes): try: return...
def reflect_static_member(cls, name): """Reflect 'name' using ONLY static reflection. You most likely want to use ScopeStack.reflect instead. Returns: Type of 'name', or protocol.AnyType. """ for scope in reversed(cls.scopes): try: return...
[ "Reflect", "name", "using", "ONLY", "static", "reflection", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/scope.py#L189-L203
[ "def", "reflect_static_member", "(", "cls", ",", "name", ")", ":", "for", "scope", "in", "reversed", "(", "cls", ".", "scopes", ")", ":", "try", ":", "return", "structured", ".", "reflect_static_member", "(", "scope", ",", "name", ")", "except", "(", "No...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
get_hostmap
We abuse the profile combination to also derive a pilot-host map, which will tell us on what exact host each pilot has been running. To do so, we check for the PMGR_ACTIVE advance event in agent_0.prof, and use the NTP sync info to associate a hostname.
src/radical/entk/utils/prof_utils.py
def get_hostmap(profile): ''' We abuse the profile combination to also derive a pilot-host map, which will tell us on what exact host each pilot has been running. To do so, we check for the PMGR_ACTIVE advance event in agent_0.prof, and use the NTP sync info to associate a hostname. ''' # F...
def get_hostmap(profile): ''' We abuse the profile combination to also derive a pilot-host map, which will tell us on what exact host each pilot has been running. To do so, we check for the PMGR_ACTIVE advance event in agent_0.prof, and use the NTP sync info to associate a hostname. ''' # F...
[ "We", "abuse", "the", "profile", "combination", "to", "also", "derive", "a", "pilot", "-", "host", "map", "which", "will", "tell", "us", "on", "what", "exact", "host", "each", "pilot", "has", "been", "running", ".", "To", "do", "so", "we", "check", "fo...
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/utils/prof_utils.py#L16-L31
[ "def", "get_hostmap", "(", "profile", ")", ":", "# FIXME: This should be replaced by proper hostname logging", "# in `pilot.resource_details`.", "hostmap", "=", "dict", "(", ")", "# map pilot IDs to host names", "for", "entry", "in", "profile", ":", "if", "entry", "[...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
get_hostmap_deprecated
This method mangles combine_profiles and get_hostmap, and is deprecated. At this point it only returns the hostmap
src/radical/entk/utils/prof_utils.py
def get_hostmap_deprecated(profiles): ''' This method mangles combine_profiles and get_hostmap, and is deprecated. At this point it only returns the hostmap ''' hostmap = dict() # map pilot IDs to host names for pname, prof in profiles.iteritems(): if not len(prof): conti...
def get_hostmap_deprecated(profiles): ''' This method mangles combine_profiles and get_hostmap, and is deprecated. At this point it only returns the hostmap ''' hostmap = dict() # map pilot IDs to host names for pname, prof in profiles.iteritems(): if not len(prof): conti...
[ "This", "method", "mangles", "combine_profiles", "and", "get_hostmap", "and", "is", "deprecated", ".", "At", "this", "point", "it", "only", "returns", "the", "hostmap" ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/utils/prof_utils.py#L34-L60
[ "def", "get_hostmap_deprecated", "(", "profiles", ")", ":", "hostmap", "=", "dict", "(", ")", "# map pilot IDs to host names", "for", "pname", ",", "prof", "in", "profiles", ".", "iteritems", "(", ")", ":", "if", "not", "len", "(", "prof", ")", ":", "conti...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
AppManager.run
**Purpose**: Run the application manager. Once the workflow and resource manager have been assigned. Invoking this method will start the setting up the communication infrastructure, submitting a resource request and then submission of all the tasks.
src/radical/entk/appman/appmanager.py
def run(self): """ **Purpose**: Run the application manager. Once the workflow and resource manager have been assigned. Invoking this method will start the setting up the communication infrastructure, submitting a resource request and then submission of all the tasks. """ ...
def run(self): """ **Purpose**: Run the application manager. Once the workflow and resource manager have been assigned. Invoking this method will start the setting up the communication infrastructure, submitting a resource request and then submission of all the tasks. """ ...
[ "**", "Purpose", "**", ":", "Run", "the", "application", "manager", ".", "Once", "the", "workflow", "and", "resource", "manager", "have", "been", "assigned", ".", "Invoking", "this", "method", "will", "start", "the", "setting", "up", "the", "communication", ...
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/appman/appmanager.py#L247-L503
[ "def", "run", "(", "self", ")", ":", "try", ":", "# Set None objects local to each run", "self", ".", "_wfp", "=", "None", "self", ".", "_sync_thread", "=", "None", "self", ".", "_terminate_sync", "=", "Event", "(", ")", "self", ".", "_resubmit_failed", "=",...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
AppManager._setup_mqs
**Purpose**: Setup RabbitMQ system on the client side. We instantiate queue(s) 'pendingq-*' for communication between the enqueuer thread and the task manager process. We instantiate queue(s) 'completedq-*' for communication between the task manager and dequeuer thread. We instantiate queue 'sync-to-mas...
src/radical/entk/appman/appmanager.py
def _setup_mqs(self): """ **Purpose**: Setup RabbitMQ system on the client side. We instantiate queue(s) 'pendingq-*' for communication between the enqueuer thread and the task manager process. We instantiate queue(s) 'completedq-*' for communication between the task manager and dequeuer...
def _setup_mqs(self): """ **Purpose**: Setup RabbitMQ system on the client side. We instantiate queue(s) 'pendingq-*' for communication between the enqueuer thread and the task manager process. We instantiate queue(s) 'completedq-*' for communication between the task manager and dequeuer...
[ "**", "Purpose", "**", ":", "Setup", "RabbitMQ", "system", "on", "the", "client", "side", ".", "We", "instantiate", "queue", "(", "s", ")", "pendingq", "-", "*", "for", "communication", "between", "the", "enqueuer", "thread", "and", "the", "task", "manager...
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/appman/appmanager.py#L527-L589
[ "def", "_setup_mqs", "(", "self", ")", ":", "try", ":", "self", ".", "_prof", ".", "prof", "(", "'init mqs setup'", ",", "uid", "=", "self", ".", "_uid", ")", "self", ".", "_logger", ".", "debug", "(", "'Setting up mq connection and channel'", ")", "mq_con...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
AppManager._synchronizer
**Purpose**: Thread in the master process to keep the workflow data structure in appmanager up to date. We receive pipelines, stages and tasks objects directly. The respective object is updated in this master process. Details: Important to note that acknowledgements of the type ...
src/radical/entk/appman/appmanager.py
def _synchronizer(self): """ **Purpose**: Thread in the master process to keep the workflow data structure in appmanager up to date. We receive pipelines, stages and tasks objects directly. The respective object is updated in this master process. Details: Important to no...
def _synchronizer(self): """ **Purpose**: Thread in the master process to keep the workflow data structure in appmanager up to date. We receive pipelines, stages and tasks objects directly. The respective object is updated in this master process. Details: Important to no...
[ "**", "Purpose", "**", ":", "Thread", "in", "the", "master", "process", "to", "keep", "the", "workflow", "data", "structure", "in", "appmanager", "up", "to", "date", ".", "We", "receive", "pipelines", "stages", "and", "tasks", "objects", "directly", ".", "...
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/appman/appmanager.py#L619-L958
[ "def", "_synchronizer", "(", "self", ")", ":", "try", ":", "self", ".", "_prof", ".", "prof", "(", "'synchronizer started'", ",", "uid", "=", "self", ".", "_uid", ")", "self", ".", "_logger", ".", "info", "(", "'synchronizer thread started'", ")", "def", ...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
MetricCategoryForm.categorize_metrics
Called only on a valid form, this method will place the chosen metrics in the given catgory.
redis_metrics/forms.py
def categorize_metrics(self): """Called only on a valid form, this method will place the chosen metrics in the given catgory.""" category = self.cleaned_data['category_name'] metrics = self.cleaned_data['metrics'] self.r.reset_category(category, metrics)
def categorize_metrics(self): """Called only on a valid form, this method will place the chosen metrics in the given catgory.""" category = self.cleaned_data['category_name'] metrics = self.cleaned_data['metrics'] self.r.reset_category(category, metrics)
[ "Called", "only", "on", "a", "valid", "form", "this", "method", "will", "place", "the", "chosen", "metrics", "in", "the", "given", "catgory", "." ]
bradmontgomery/django-redis-metrics
python
https://github.com/bradmontgomery/django-redis-metrics/blob/2c92332920113d28c39234b949aa496b39a091d1/redis_metrics/forms.py#L50-L55
[ "def", "categorize_metrics", "(", "self", ")", ":", "category", "=", "self", ".", "cleaned_data", "[", "'category_name'", "]", "metrics", "=", "self", ".", "cleaned_data", "[", "'metrics'", "]", "self", ".", "r", ".", "reset_category", "(", "category", ",", ...
2c92332920113d28c39234b949aa496b39a091d1
train
ResourceManager._submit_resource_request
**Purpose**: Create and submits a RADICAL Pilot Job as per the user provided resource description
src/radical/entk/execman/rp/resource_manager.py
def _submit_resource_request(self): """ **Purpose**: Create and submits a RADICAL Pilot Job as per the user provided resource description """ try: self._prof.prof('creating rreq', uid=self._uid) def _pilot_state_cb(pilot, state): ...
def _submit_resource_request(self): """ **Purpose**: Create and submits a RADICAL Pilot Job as per the user provided resource description """ try: self._prof.prof('creating rreq', uid=self._uid) def _pilot_state_cb(pilot, state): ...
[ "**", "Purpose", "**", ":", "Create", "and", "submits", "a", "RADICAL", "Pilot", "Job", "as", "per", "the", "user", "provided", "resource", "description" ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/resource_manager.py#L106-L188
[ "def", "_submit_resource_request", "(", "self", ")", ":", "try", ":", "self", ".", "_prof", ".", "prof", "(", "'creating rreq'", ",", "uid", "=", "self", ".", "_uid", ")", "def", "_pilot_state_cb", "(", "pilot", ",", "state", ")", ":", "self", ".", "_l...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
ResourceManager._terminate_resource_request
**Purpose**: Cancel the RADICAL Pilot Job
src/radical/entk/execman/rp/resource_manager.py
def _terminate_resource_request(self): """ **Purpose**: Cancel the RADICAL Pilot Job """ try: if self._pilot: self._prof.prof('canceling resource allocation', uid=self._uid) self._pilot.cancel() download_rp_profile = os.envir...
def _terminate_resource_request(self): """ **Purpose**: Cancel the RADICAL Pilot Job """ try: if self._pilot: self._prof.prof('canceling resource allocation', uid=self._uid) self._pilot.cancel() download_rp_profile = os.envir...
[ "**", "Purpose", "**", ":", "Cancel", "the", "RADICAL", "Pilot", "Job" ]
radical-cybertools/radical.entk
python
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/resource_manager.py#L190-L214
[ "def", "_terminate_resource_request", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_pilot", ":", "self", ".", "_prof", ".", "prof", "(", "'canceling resource allocation'", ",", "uid", "=", "self", ".", "_uid", ")", "self", ".", "_pilot", ".", "...
945f6c93c9a62db90ad191b306418d5c1cdd9d24
train
Solaredge.get_list
Request service locations Returns ------- dict
solaredge/solaredge.py
def get_list(self, size=100, startIndex=0, searchText="", sortProperty="", sortOrder='ASC', status='Active,Pending'): """ Request service locations Returns ------- dict """ url = urljoin(BASEURL, "sites", "list") params = { 'api_key': self.t...
def get_list(self, size=100, startIndex=0, searchText="", sortProperty="", sortOrder='ASC', status='Active,Pending'): """ Request service locations Returns ------- dict """ url = urljoin(BASEURL, "sites", "list") params = { 'api_key': self.t...
[ "Request", "service", "locations" ]
bertouttier/solaredge
python
https://github.com/bertouttier/solaredge/blob/2c94b38527374b0abd088e2819455b332bc5153a/solaredge/solaredge.py#L30-L57
[ "def", "get_list", "(", "self", ",", "size", "=", "100", ",", "startIndex", "=", "0", ",", "searchText", "=", "\"\"", ",", "sortProperty", "=", "\"\"", ",", "sortOrder", "=", "'ASC'", ",", "status", "=", "'Active,Pending'", ")", ":", "url", "=", "urljo...
2c94b38527374b0abd088e2819455b332bc5153a
train
TokenStream.match
Match grammar function 'f' against next token and set 'self.matched'. Arguments: f: A grammar function - see efilter.parsers.common.grammar. Must return TokenMatch or None. args: Passed to 'f', if any. Returns: Instance of efilter.parsers.common.gram...
efilter/parsers/common/token_stream.py
def match(self, f, *args): """Match grammar function 'f' against next token and set 'self.matched'. Arguments: f: A grammar function - see efilter.parsers.common.grammar. Must return TokenMatch or None. args: Passed to 'f', if any. Returns: I...
def match(self, f, *args): """Match grammar function 'f' against next token and set 'self.matched'. Arguments: f: A grammar function - see efilter.parsers.common.grammar. Must return TokenMatch or None. args: Passed to 'f', if any. Returns: I...
[ "Match", "grammar", "function", "f", "against", "next", "token", "and", "set", "self", ".", "matched", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/token_stream.py#L46-L76
[ "def", "match", "(", "self", ",", "f", ",", "*", "args", ")", ":", "try", ":", "match", "=", "f", "(", "self", ".", "tokenizer", ",", "*", "args", ")", "except", "StopIteration", ":", "# The grammar function might have tried to access more tokens than", "# are...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
TokenStream.accept
Like 'match', but consume the token (tokenizer advances.)
efilter/parsers/common/token_stream.py
def accept(self, f, *args): """Like 'match', but consume the token (tokenizer advances.)""" match = self.match(f, *args) if match is None: return self.tokenizer.skip(len(match.tokens)) return match
def accept(self, f, *args): """Like 'match', but consume the token (tokenizer advances.)""" match = self.match(f, *args) if match is None: return self.tokenizer.skip(len(match.tokens)) return match
[ "Like", "match", "but", "consume", "the", "token", "(", "tokenizer", "advances", ".", ")" ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/token_stream.py#L78-L85
[ "def", "accept", "(", "self", ",", "f", ",", "*", "args", ")", ":", "match", "=", "self", ".", "match", "(", "f", ",", "*", "args", ")", "if", "match", "is", "None", ":", "return", "self", ".", "tokenizer", ".", "skip", "(", "len", "(", "match"...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
TokenStream.reject
Like 'match', but throw a parse error if 'f' matches. This is useful when a parser wants to be strict about specific things being prohibited. For example, DottySQL bans the use of SQL keywords as variable names.
efilter/parsers/common/token_stream.py
def reject(self, f, *args): """Like 'match', but throw a parse error if 'f' matches. This is useful when a parser wants to be strict about specific things being prohibited. For example, DottySQL bans the use of SQL keywords as variable names. """ match = self.match(f, *a...
def reject(self, f, *args): """Like 'match', but throw a parse error if 'f' matches. This is useful when a parser wants to be strict about specific things being prohibited. For example, DottySQL bans the use of SQL keywords as variable names. """ match = self.match(f, *a...
[ "Like", "match", "but", "throw", "a", "parse", "error", "if", "f", "matches", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/token_stream.py#L87-L99
[ "def", "reject", "(", "self", ",", "f", ",", "*", "args", ")", ":", "match", "=", "self", ".", "match", "(", "f", ",", "*", "args", ")", "if", "match", ":", "token", "=", "self", ".", "peek", "(", "0", ")", "raise", "errors", ".", "EfilterParse...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
TokenStream.expect
Like 'accept' but throws a parse error if 'f' doesn't match.
efilter/parsers/common/token_stream.py
def expect(self, f, *args): """Like 'accept' but throws a parse error if 'f' doesn't match.""" match = self.accept(f, *args) if match: return match try: func_name = f.func_name except AttributeError: func_name = "<unnamed grammar function>" ...
def expect(self, f, *args): """Like 'accept' but throws a parse error if 'f' doesn't match.""" match = self.accept(f, *args) if match: return match try: func_name = f.func_name except AttributeError: func_name = "<unnamed grammar function>" ...
[ "Like", "accept", "but", "throws", "a", "parse", "error", "if", "f", "doesn", "t", "match", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/token_stream.py#L101-L115
[ "def", "expect", "(", "self", ",", "f", ",", "*", "args", ")", ":", "match", "=", "self", ".", "accept", "(", "f", ",", "*", "args", ")", "if", "match", ":", "return", "match", "try", ":", "func_name", "=", "f", ".", "func_name", "except", "Attri...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
TokenStream.current_position
Return a tuple of (start, end).
efilter/parsers/common/token_stream.py
def current_position(self): """Return a tuple of (start, end).""" token = self.tokenizer.peek(0) if token: return token.start, token.end return self.tokenizer.position, self.tokenizer.position + 1
def current_position(self): """Return a tuple of (start, end).""" token = self.tokenizer.peek(0) if token: return token.start, token.end return self.tokenizer.position, self.tokenizer.position + 1
[ "Return", "a", "tuple", "of", "(", "start", "end", ")", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/token_stream.py#L117-L123
[ "def", "current_position", "(", "self", ")", ":", "token", "=", "self", ".", "tokenizer", ".", "peek", "(", "0", ")", "if", "token", ":", "return", "token", ".", "start", ",", "token", ".", "end", "return", "self", ".", "tokenizer", ".", "position", ...
b145131499be0c4b755fc2e2ac19be11a50bce6a
train
ComplementEquivalence
Change x != y to not(x == y).
efilter/parsers/common/ast_transforms.py
def ComplementEquivalence(*args, **kwargs): """Change x != y to not(x == y).""" return ast.Complement( ast.Equivalence(*args, **kwargs), **kwargs)
def ComplementEquivalence(*args, **kwargs): """Change x != y to not(x == y).""" return ast.Complement( ast.Equivalence(*args, **kwargs), **kwargs)
[ "Change", "x", "!", "=", "y", "to", "not", "(", "x", "==", "y", ")", "." ]
google/dotty
python
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/ast_transforms.py#L43-L46
[ "def", "ComplementEquivalence", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "ast", ".", "Complement", "(", "ast", ".", "Equivalence", "(", "*", "args", ",", "*", "*", "kwargs", ")", ",", "*", "*", "kwargs", ")" ]
b145131499be0c4b755fc2e2ac19be11a50bce6a