repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
diffeo/py-nilsimsa
nilsimsa/__init__.py
Nilsimsa.process
def process(self, chunk): """ computes the hash of all of the trigrams in the chunk using a window of length 5 """ self._digest = None if isinstance(chunk, text_type): chunk = chunk.encode('utf-8') # chunk is a byte string for char in chunk: ...
python
def process(self, chunk): """ computes the hash of all of the trigrams in the chunk using a window of length 5 """ self._digest = None if isinstance(chunk, text_type): chunk = chunk.encode('utf-8') # chunk is a byte string for char in chunk: ...
[ "def", "process", "(", "self", ",", "chunk", ")", ":", "self", ".", "_digest", "=", "None", "if", "isinstance", "(", "chunk", ",", "text_type", ")", ":", "chunk", "=", "chunk", ".", "encode", "(", "'utf-8'", ")", "# chunk is a byte string", "for", "char"...
computes the hash of all of the trigrams in the chunk using a window of length 5
[ "computes", "the", "hash", "of", "all", "of", "the", "trigrams", "in", "the", "chunk", "using", "a", "window", "of", "length", "5" ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/__init__.py#L103-L138
train
diffeo/py-nilsimsa
nilsimsa/__init__.py
Nilsimsa.compute_digest
def compute_digest(self): """ using a threshold (mean of the accumulator), computes the nilsimsa digest """ num_trigrams = 0 if self.num_char == 3: # 3 chars -> 1 trigram num_trigrams = 1 elif self.num_char == 4: # 4 chars -> 4 trigrams ...
python
def compute_digest(self): """ using a threshold (mean of the accumulator), computes the nilsimsa digest """ num_trigrams = 0 if self.num_char == 3: # 3 chars -> 1 trigram num_trigrams = 1 elif self.num_char == 4: # 4 chars -> 4 trigrams ...
[ "def", "compute_digest", "(", "self", ")", ":", "num_trigrams", "=", "0", "if", "self", ".", "num_char", "==", "3", ":", "# 3 chars -> 1 trigram", "num_trigrams", "=", "1", "elif", "self", ".", "num_char", "==", "4", ":", "# 4 chars -> 4 trigrams", "num_trigra...
using a threshold (mean of the accumulator), computes the nilsimsa digest
[ "using", "a", "threshold", "(", "mean", "of", "the", "accumulator", ")", "computes", "the", "nilsimsa", "digest" ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/__init__.py#L141-L161
train
diffeo/py-nilsimsa
nilsimsa/__init__.py
Nilsimsa.from_file
def from_file(self, fname): """read in a file and compute digest""" f = open(fname, "rb") data = f.read() self.update(data) f.close()
python
def from_file(self, fname): """read in a file and compute digest""" f = open(fname, "rb") data = f.read() self.update(data) f.close()
[ "def", "from_file", "(", "self", ",", "fname", ")", ":", "f", "=", "open", "(", "fname", ",", "\"rb\"", ")", "data", "=", "f", ".", "read", "(", ")", "self", ".", "update", "(", "data", ")", "f", ".", "close", "(", ")" ]
read in a file and compute digest
[ "read", "in", "a", "file", "and", "compute", "digest" ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/__init__.py#L182-L187
train
diffeo/py-nilsimsa
nilsimsa/__init__.py
Nilsimsa.compare
def compare(self, digest_2, is_hex = False): """ returns difference between the nilsimsa digests between the current object and a given digest """ # convert hex string to list of ints if is_hex: digest_2 = convert_hex_to_ints(digest_2) bit_diff = 0 ...
python
def compare(self, digest_2, is_hex = False): """ returns difference between the nilsimsa digests between the current object and a given digest """ # convert hex string to list of ints if is_hex: digest_2 = convert_hex_to_ints(digest_2) bit_diff = 0 ...
[ "def", "compare", "(", "self", ",", "digest_2", ",", "is_hex", "=", "False", ")", ":", "# convert hex string to list of ints", "if", "is_hex", ":", "digest_2", "=", "convert_hex_to_ints", "(", "digest_2", ")", "bit_diff", "=", "0", "for", "i", "in", "range", ...
returns difference between the nilsimsa digests between the current object and a given digest
[ "returns", "difference", "between", "the", "nilsimsa", "digests", "between", "the", "current", "object", "and", "a", "given", "digest" ]
c652f4bbfd836f7aebf292dcea676cc925ec315a
https://github.com/diffeo/py-nilsimsa/blob/c652f4bbfd836f7aebf292dcea676cc925ec315a/nilsimsa/__init__.py#L189-L202
train
CloudGenix/sdk-python
cloudgenix/post_api.py
Post.login
def login(self, data, api_version="v2.0"): """ Login api **Parameters:**: - **data**: Dictionary containing data to POST as JSON - **api_version**: API version to use (default v2.0) **Returns:** requests.Response object extended with cgx_status and cgx_content pr...
python
def login(self, data, api_version="v2.0"): """ Login api **Parameters:**: - **data**: Dictionary containing data to POST as JSON - **api_version**: API version to use (default v2.0) **Returns:** requests.Response object extended with cgx_status and cgx_content pr...
[ "def", "login", "(", "self", ",", "data", ",", "api_version", "=", "\"v2.0\"", ")", ":", "cur_ctlr", "=", "self", ".", "_parent_class", ".", "controller", "url", "=", "str", "(", "cur_ctlr", ")", "+", "\"/{}/api/login\"", ".", "format", "(", "api_version",...
Login api **Parameters:**: - **data**: Dictionary containing data to POST as JSON - **api_version**: API version to use (default v2.0) **Returns:** requests.Response object extended with cgx_status and cgx_content properties.
[ "Login", "api" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/post_api.py#L1050-L1067
train
CloudGenix/sdk-python
cloudgenix/post_api.py
Post.tenant_forgot_password_login
def tenant_forgot_password_login(self, data, tenant_id=None, api_version="v2.0"): """ Forgot password API **Parameters:**: - **data**: Dictionary containing data to POST as JSON - **tenant_id**: Tenant ID - **api_version**: API version to use (default v2.0) ...
python
def tenant_forgot_password_login(self, data, tenant_id=None, api_version="v2.0"): """ Forgot password API **Parameters:**: - **data**: Dictionary containing data to POST as JSON - **tenant_id**: Tenant ID - **api_version**: API version to use (default v2.0) ...
[ "def", "tenant_forgot_password_login", "(", "self", ",", "data", ",", "tenant_id", "=", "None", ",", "api_version", "=", "\"v2.0\"", ")", ":", "if", "tenant_id", "is", "None", "and", "self", ".", "_parent_class", ".", "tenant_id", ":", "# Pull tenant_id from par...
Forgot password API **Parameters:**: - **data**: Dictionary containing data to POST as JSON - **tenant_id**: Tenant ID - **api_version**: API version to use (default v2.0) **Returns:** requests.Response object extended with cgx_status and cgx_content properties.
[ "Forgot", "password", "API" ]
1b2f92582b6a19769134914793bfd00e4caa074b
https://github.com/CloudGenix/sdk-python/blob/1b2f92582b6a19769134914793bfd00e4caa074b/cloudgenix/post_api.py#L3458-L3483
train
kenjoe41/ghostpaste
ghostpaste/ghostpaste.py
is_valid_file
def is_valid_file(parser,arg): """verify the validity of the given file. Never trust the End-User""" if not os.path.exists(arg): parser.error("File %s not found"%arg) else: return arg
python
def is_valid_file(parser,arg): """verify the validity of the given file. Never trust the End-User""" if not os.path.exists(arg): parser.error("File %s not found"%arg) else: return arg
[ "def", "is_valid_file", "(", "parser", ",", "arg", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "arg", ")", ":", "parser", ".", "error", "(", "\"File %s not found\"", "%", "arg", ")", "else", ":", "return", "arg" ]
verify the validity of the given file. Never trust the End-User
[ "verify", "the", "validity", "of", "the", "given", "file", ".", "Never", "trust", "the", "End", "-", "User" ]
7811878fb06c661eb0e7fe2cf5601a87aa858d30
https://github.com/kenjoe41/ghostpaste/blob/7811878fb06c661eb0e7fe2cf5601a87aa858d30/ghostpaste/ghostpaste.py#L28-L33
train
kenjoe41/ghostpaste
ghostpaste/ghostpaste.py
getID
def getID(code_file): """Get the language ID of the input file language""" json_path = ghostfolder+'/'+json_file if os.path.exists(json_path): pass else: download_file('https://ghostbin.com/languages.json') lang = detect_lang(code_file) json_data = json.load(file(json_path))#don't think i need this though ...
python
def getID(code_file): """Get the language ID of the input file language""" json_path = ghostfolder+'/'+json_file if os.path.exists(json_path): pass else: download_file('https://ghostbin.com/languages.json') lang = detect_lang(code_file) json_data = json.load(file(json_path))#don't think i need this though ...
[ "def", "getID", "(", "code_file", ")", ":", "json_path", "=", "ghostfolder", "+", "'/'", "+", "json_file", "if", "os", ".", "path", ".", "exists", "(", "json_path", ")", ":", "pass", "else", ":", "download_file", "(", "'https://ghostbin.com/languages.json'", ...
Get the language ID of the input file language
[ "Get", "the", "language", "ID", "of", "the", "input", "file", "language" ]
7811878fb06c661eb0e7fe2cf5601a87aa858d30
https://github.com/kenjoe41/ghostpaste/blob/7811878fb06c661eb0e7fe2cf5601a87aa858d30/ghostpaste/ghostpaste.py#L65-L83
train
kenjoe41/ghostpaste
ghostpaste/ghostpaste.py
detect_lang
def detect_lang(path): """Detect the language used in the given file.""" blob = FileBlob(path, os.getcwd()) if blob.is_text: print('Programming language of the file detected: {0}'.format(blob.language.name)) return blob.language.name else:#images, binary and what-have-you won't be pasted print('File not a tex...
python
def detect_lang(path): """Detect the language used in the given file.""" blob = FileBlob(path, os.getcwd()) if blob.is_text: print('Programming language of the file detected: {0}'.format(blob.language.name)) return blob.language.name else:#images, binary and what-have-you won't be pasted print('File not a tex...
[ "def", "detect_lang", "(", "path", ")", ":", "blob", "=", "FileBlob", "(", "path", ",", "os", ".", "getcwd", "(", ")", ")", "if", "blob", ".", "is_text", ":", "print", "(", "'Programming language of the file detected: {0}'", ".", "format", "(", "blob", "."...
Detect the language used in the given file.
[ "Detect", "the", "language", "used", "in", "the", "given", "file", "." ]
7811878fb06c661eb0e7fe2cf5601a87aa858d30
https://github.com/kenjoe41/ghostpaste/blob/7811878fb06c661eb0e7fe2cf5601a87aa858d30/ghostpaste/ghostpaste.py#L84-L92
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.set_serial
def set_serial(self, android_serial): """ Specify given *android_serial* device to perform test. You do not have to specify the device when there is only one device connects to the computer. When you need to use multiple devices, do not use this keyword to switch between devices in tes...
python
def set_serial(self, android_serial): """ Specify given *android_serial* device to perform test. You do not have to specify the device when there is only one device connects to the computer. When you need to use multiple devices, do not use this keyword to switch between devices in tes...
[ "def", "set_serial", "(", "self", ",", "android_serial", ")", ":", "self", ".", "adb", "=", "ADB", "(", "android_serial", ")", "self", ".", "device", "=", "Device", "(", "android_serial", ")", "self", ".", "test_helper", "=", "TestHelper", "(", "self", "...
Specify given *android_serial* device to perform test. You do not have to specify the device when there is only one device connects to the computer. When you need to use multiple devices, do not use this keyword to switch between devices in test execution. Using different library name when im...
[ "Specify", "given", "*", "android_serial", "*", "device", "to", "perform", "test", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L59-L82
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.click_at_coordinates
def click_at_coordinates(self, x, y): """ Click at (x,y) coordinates. """ self.device.click(int(x), int(y))
python
def click_at_coordinates(self, x, y): """ Click at (x,y) coordinates. """ self.device.click(int(x), int(y))
[ "def", "click_at_coordinates", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "device", ".", "click", "(", "int", "(", "x", ")", ",", "int", "(", "y", ")", ")" ]
Click at (x,y) coordinates.
[ "Click", "at", "(", "x", "y", ")", "coordinates", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L249-L253
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.swipe_by_coordinates
def swipe_by_coordinates(self, sx, sy, ex, ey, steps=10): """ Swipe from (sx, sy) to (ex, ey) with *steps* . Example: | Swipe By Coordinates | 540 | 1340 | 940 | 1340 | | # Swipe from (540, 1340) to (940, 100) with default steps 10 | | Swipe By Coordinates | 540 | 1340 | 940...
python
def swipe_by_coordinates(self, sx, sy, ex, ey, steps=10): """ Swipe from (sx, sy) to (ex, ey) with *steps* . Example: | Swipe By Coordinates | 540 | 1340 | 940 | 1340 | | # Swipe from (540, 1340) to (940, 100) with default steps 10 | | Swipe By Coordinates | 540 | 1340 | 940...
[ "def", "swipe_by_coordinates", "(", "self", ",", "sx", ",", "sy", ",", "ex", ",", "ey", ",", "steps", "=", "10", ")", ":", "self", ".", "device", ".", "swipe", "(", "sx", ",", "sy", ",", "ex", ",", "ey", ",", "steps", ")" ]
Swipe from (sx, sy) to (ex, ey) with *steps* . Example: | Swipe By Coordinates | 540 | 1340 | 940 | 1340 | | # Swipe from (540, 1340) to (940, 100) with default steps 10 | | Swipe By Coordinates | 540 | 1340 | 940 | 1340 | 100 | # Swipe from (540, 1340) to (940, 100) with steps 100 |
[ "Swipe", "from", "(", "sx", "sy", ")", "to", "(", "ex", "ey", ")", "with", "*", "steps", "*", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L255-L263
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.swipe_left
def swipe_left(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to left. Example: | Swipe Left | description=Home screen 3 | | # swipe the UI object left | | Swipe Left | 5 |...
python
def swipe_left(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to left. Example: | Swipe Left | description=Home screen 3 | | # swipe the UI object left | | Swipe Left | 5 |...
[ "def", "swipe_left", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "swipe", ".", "left", "(", "steps", "=", "steps", ")" ]
Swipe the UI object with *selectors* from center to left. Example: | Swipe Left | description=Home screen 3 | | # swipe the UI object left | | Swipe Left | 5 | description=Home screen 3 | # swipe the UI object left with steps=5 | ...
[ "Swipe", "the", "UI", "object", "with", "*", "selectors", "*", "from", "center", "to", "left", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L267-L278
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.swipe_right
def swipe_right(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to right See `Swipe Left` for more details. """ self.device(**selectors).swipe.right(steps=steps)
python
def swipe_right(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to right See `Swipe Left` for more details. """ self.device(**selectors).swipe.right(steps=steps)
[ "def", "swipe_right", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "swipe", ".", "right", "(", "steps", "=", "steps", ")" ]
Swipe the UI object with *selectors* from center to right See `Swipe Left` for more details.
[ "Swipe", "the", "UI", "object", "with", "*", "selectors", "*", "from", "center", "to", "right" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L280-L286
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.swipe_top
def swipe_top(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to top See `Swipe Left` for more details. """ self.device(**selectors).swipe.up(steps=steps)
python
def swipe_top(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to top See `Swipe Left` for more details. """ self.device(**selectors).swipe.up(steps=steps)
[ "def", "swipe_top", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "swipe", ".", "up", "(", "steps", "=", "steps", ")" ]
Swipe the UI object with *selectors* from center to top See `Swipe Left` for more details.
[ "Swipe", "the", "UI", "object", "with", "*", "selectors", "*", "from", "center", "to", "top" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L288-L294
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.swipe_bottom
def swipe_bottom(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to bottom See `Swipe Left` for more details. """ self.device(**selectors).swipe.down(steps=steps)
python
def swipe_bottom(self, steps=10, *args, **selectors): """ Swipe the UI object with *selectors* from center to bottom See `Swipe Left` for more details. """ self.device(**selectors).swipe.down(steps=steps)
[ "def", "swipe_bottom", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "swipe", ".", "down", "(", "steps", "=", "steps", ")" ]
Swipe the UI object with *selectors* from center to bottom See `Swipe Left` for more details.
[ "Swipe", "the", "UI", "object", "with", "*", "selectors", "*", "from", "center", "to", "bottom" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L296-L302
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.drag_by_coordinates
def drag_by_coordinates(self,sx, sy, ex, ey, steps=10): """ Drag from (sx, sy) to (ex, ey) with steps See `Swipe By Coordinates` also. """ self.device.drag(sx, sy, ex, ey, steps)
python
def drag_by_coordinates(self,sx, sy, ex, ey, steps=10): """ Drag from (sx, sy) to (ex, ey) with steps See `Swipe By Coordinates` also. """ self.device.drag(sx, sy, ex, ey, steps)
[ "def", "drag_by_coordinates", "(", "self", ",", "sx", ",", "sy", ",", "ex", ",", "ey", ",", "steps", "=", "10", ")", ":", "self", ".", "device", ".", "drag", "(", "sx", ",", "sy", ",", "ex", ",", "ey", ",", "steps", ")" ]
Drag from (sx, sy) to (ex, ey) with steps See `Swipe By Coordinates` also.
[ "Drag", "from", "(", "sx", "sy", ")", "to", "(", "ex", "ey", ")", "with", "steps" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L343-L349
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.wait_for_exists
def wait_for_exists(self, timeout=0, *args, **selectors): """ Wait for the object which has *selectors* within the given timeout. Return true if the object *appear* in the given timeout. Else return false. """ return self.device(**selectors).wait.exists(timeout=timeout)
python
def wait_for_exists(self, timeout=0, *args, **selectors): """ Wait for the object which has *selectors* within the given timeout. Return true if the object *appear* in the given timeout. Else return false. """ return self.device(**selectors).wait.exists(timeout=timeout)
[ "def", "wait_for_exists", "(", "self", ",", "timeout", "=", "0", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "wait", ".", "exists", "(", "timeout", "=", "timeout", "...
Wait for the object which has *selectors* within the given timeout. Return true if the object *appear* in the given timeout. Else return false.
[ "Wait", "for", "the", "object", "which", "has", "*", "selectors", "*", "within", "the", "given", "timeout", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L354-L360
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.wait_until_gone
def wait_until_gone(self, timeout=0, *args, **selectors): """ Wait for the object which has *selectors* within the given timeout. Return true if the object *disappear* in the given timeout. Else return false. """ return self.device(**selectors).wait.gone(timeout=timeout)
python
def wait_until_gone(self, timeout=0, *args, **selectors): """ Wait for the object which has *selectors* within the given timeout. Return true if the object *disappear* in the given timeout. Else return false. """ return self.device(**selectors).wait.gone(timeout=timeout)
[ "def", "wait_until_gone", "(", "self", ",", "timeout", "=", "0", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "wait", ".", "gone", "(", "timeout", "=", "timeout", ")"...
Wait for the object which has *selectors* within the given timeout. Return true if the object *disappear* in the given timeout. Else return false.
[ "Wait", "for", "the", "object", "which", "has", "*", "selectors", "*", "within", "the", "given", "timeout", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L363-L369
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.fling_forward_horizontally
def fling_forward_horizontally(self, *args, **selectors): """ Perform fling forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.horiz.forward()
python
def fling_forward_horizontally(self, *args, **selectors): """ Perform fling forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.horiz.forward()
[ "def", "fling_forward_horizontally", "(", "self", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "fling", ".", "horiz", ".", "forward", "(", ")" ]
Perform fling forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not.
[ "Perform", "fling", "forward", "(", "horizontally", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L390-L396
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.fling_backward_horizontally
def fling_backward_horizontally(self, *args, **selectors): """ Perform fling backward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.horiz.backward()
python
def fling_backward_horizontally(self, *args, **selectors): """ Perform fling backward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.horiz.backward()
[ "def", "fling_backward_horizontally", "(", "self", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "fling", ".", "horiz", ".", "backward", "(", ")" ]
Perform fling backward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not.
[ "Perform", "fling", "backward", "(", "horizontally", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L398-L404
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.fling_forward_vertically
def fling_forward_vertically(self, *args, **selectors): """ Perform fling forward (vertically)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.vert.forward()
python
def fling_forward_vertically(self, *args, **selectors): """ Perform fling forward (vertically)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.vert.forward()
[ "def", "fling_forward_vertically", "(", "self", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "fling", ".", "vert", ".", "forward", "(", ")" ]
Perform fling forward (vertically)action on the object which has *selectors* attributes. Return whether the object can be fling or not.
[ "Perform", "fling", "forward", "(", "vertically", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L406-L412
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.fling_backward_vertically
def fling_backward_vertically(self, *args, **selectors): """ Perform fling backward (vertically)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.vert.backward()
python
def fling_backward_vertically(self, *args, **selectors): """ Perform fling backward (vertically)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.vert.backward()
[ "def", "fling_backward_vertically", "(", "self", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "fling", ".", "vert", ".", "backward", "(", ")" ]
Perform fling backward (vertically)action on the object which has *selectors* attributes. Return whether the object can be fling or not.
[ "Perform", "fling", "backward", "(", "vertically", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L414-L420
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_to_beginning_horizontally
def scroll_to_beginning_horizontally(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* horizontally. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.horiz.toBeginning(steps=steps...
python
def scroll_to_beginning_horizontally(self, steps=10, *args,**selectors): """ Scroll the object which has *selectors* attributes to *beginning* horizontally. See `Scroll Forward Vertically` for more details. """ return self.device(**selectors).scroll.horiz.toBeginning(steps=steps...
[ "def", "scroll_to_beginning_horizontally", "(", "self", ",", "steps", "=", "10", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "horiz", ".", "toBeginning", ...
Scroll the object which has *selectors* attributes to *beginning* horizontally. See `Scroll Forward Vertically` for more details.
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "beginning", "*", "horizontally", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L425-L431
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_to_end_horizontally
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)
python
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", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "horiz", ".", "toEnd", "(", "step...
Scroll the object which has *selectors* attributes to *end* horizontally. See `Scroll Forward Vertically` for more details.
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "end", "*", "horizontally", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L433-L439
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_forward_horizontally
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...
python
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", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "horiz", ".", "forward", "(", "s...
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.
[ "Perform", "scroll", "forward", "(", "horizontally", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L441-L449
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_backward_horizontally
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...
python
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", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "horiz", ".", "backward", "(", ...
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.
[ "Perform", "scroll", "backward", "(", "horizontally", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L451-L459
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_to_horizontally
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...
python
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", ")", ":", "return", "obj", ".", "scroll", ".", "horiz", ".", "to", "(", "*", "*", "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.
[ "Scroll", "(", "horizontally", ")", "on", "the", "object", ":", "obj", "to", "specific", "UI", "object", "which", "has", "*", "selectors", "*", "attributes", "appears", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L461-L469
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_to_beginning_vertically
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)
python
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", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "toBeginning", "("...
Scroll the object which has *selectors* attributes to *beginning* vertically. See `Scroll Forward Vertically` for more details.
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "beginning", "*", "vertically", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L472-L478
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_to_end_vertically
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)
python
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", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "toEnd", "(", "steps",...
Scroll the object which has *selectors* attributes to *end* vertically. See `Scroll Forward Vertically` for more details.
[ "Scroll", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "to", "*", "end", "*", "vertically", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L480-L486
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_forward_vertically
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...
python
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", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "forward", "(", "step...
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...
[ "Perform", "scroll", "forward", "(", "vertically", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L488-L498
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_backward_vertically
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...
python
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", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "scroll", ".", "vert", ".", "backward", "(", "st...
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.
[ "Perform", "scroll", "backward", "(", "vertically", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L500-L508
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.scroll_to_vertically
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...
python
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", ")", ":", "return", "obj", ".", "scroll", ".", "vert", ".", "to", "(", "*", "*", "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=android.widget.ListView | | # Get the list object | | ${...
[ "Scroll", "(", "vertically", ")", "on", "the", "object", ":", "obj", "to", "specific", "UI", "object", "which", "has", "*", "selectors", "*", "attributes", "appears", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L510-L521
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.screenshot
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...
python
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", ")", ":", "output_dir", "=", "BuiltIn", "(", ")", ".", "get_variable_value", "(", "'${OUTPUTDIR}'", ")", "ts", "=", "time", ".", "time", "(", ")", "st", "=", "d...
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
[ "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" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L564-L574
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.register_click_watcher
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...
python
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", ")", ":", "watcher", "=", "self", ".", "device", ".", "watcher", "(", "watcher_name", ")", "for", "condition", "in", "condition_list", ":", "watche...
The watcher click on the object which has the *selectors* when conditions match.
[ "The", "watcher", "click", "on", "the", "object", "which", "has", "the", "*", "selectors", "*", "when", "conditions", "match", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L592-L600
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.register_press_watcher
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...
python
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", ")", ":", "def", "unicode_to_list", "(", "a_unicode", ")", ":", "a_list", "=", "list", "(", ")", "comma_count", "=", "a_unicode", ".", "count", ...
The watcher perform *press_keys* action sequentially when conditions match.
[ "The", "watcher", "perform", "*", "press_keys", "*", "action", "sequentially", "when", "conditions", "match", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L602-L622
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.remove_watchers
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)
python
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", ")", ":", "if", "watcher_name", "==", "None", ":", "self", ".", "device", ".", "watchers", ".", "remove", "(", ")", "else", ":", "self", ".", "device", ".", "watchers", ".", "remo...
Remove watcher with *watcher_name* or remove all watchers.
[ "Remove", "watcher", "with", "*", "watcher_name", "*", "or", "remove", "all", "watchers", "." ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L624-L631
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.get_count
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...
python
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", ")", ":", "obj", "=", "self", ".", "get_object", "(", "*", "*", "selectors", ")", "return", "self", ".", "get_count_of_object", "(", "obj", ")" ]
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 ...
[ "Return", "the", "count", "of", "UI", "object", "with", "*", "selectors", "*" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L670-L682
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.get_info_of_object
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...
python
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", ")", ":", "if", "selector", ":", "return", "obj", ".", "info", ".", "get", "(", "selector", ")", "else", ":", "return", "obj", ".", "info" ]
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': ...
[ "return", "info", "dictionary", "of", "the", "*", "obj", "*", "The", "info", "example", ":", "{", "u", "contentDescription", ":", "u", "u", "checked", ":", "False", "u", "scrollable", ":", "True", "u", "text", ":", "u", "u", "packageName", ":", "u", ...
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L692-L730
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.call
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...
python
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", ")", ":", "func", "=", "getattr", "(", "obj", ",", "method", ")", "return", "func", "(", "*", "*", "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 object | | Call | ${ac...
[ "This", "keyword", "can", "use", "object", "method", "from", "original", "python", "uiautomator" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L758-L770
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.set_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)
python
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", ")", ":", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "set_text", "(", "input_text", ")" ]
Set *input_text* to the UI object with *selectors*
[ "Set", "*", "input_text", "*", "to", "the", "UI", "object", "with", "*", "selectors", "*" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L772-L776
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.clear_text
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...
python
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", ")", ":", "while", "True", ":", "target", "=", "self", ".", "device", "(", "*", "*", "selectors", ")", "text", "=", "target", ".", "info", "[", "'text'", "]", "target",...
Clear text of the UI object with *selectors*
[ "Clear", "text", "of", "the", "UI", "object", "with", "*", "selectors", "*" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L786-L796
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.open_notification
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....
python
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", ")", ":", "sdk_version", "=", "self", ".", "device", ".", "info", "[", "'sdkInt'", "]", "if", "sdk_version", "<", "18", ":", "height", "=", "self", ".", "device", ".", "info", "[", "'displayHeight'", "]", "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
[ "Open", "notification" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L798-L812
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.sleep
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)
python
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", ")", ":", "target", "=", "'wait for %s'", "%", "str", "(", "time", ")", "self", ".", "device", "(", "text", "=", "target", ")", ".", "wait", ".", "exists", "(", "timeout", "=", "time", ")" ]
Sleep(no action) for *time* (in millisecond)
[ "Sleep", "(", "no", "action", ")", "for", "*", "time", "*", "(", "in", "millisecond", ")" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L823-L828
train
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
Mobile.connect_to_wifi
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)
python
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", ")", ":", "cmd", "=", "'am broadcast -a testagent -e action CONNECT_TO_WIFI -e ssid %s -e password %s'", "%", "(", "ssid", ",", "password", ")", "self", ".", "adb", ".", "shell_cmd", ...
[Test Agent] Connect to *ssid* with *password*
[ "[", "Test", "Agent", "]" ]
b70202b6a8aa68b4efd9d029c2845407fb33451a
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L884-L891
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
merge_sims
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...
python
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", ")", ":", "if", "oldsims", "is", "None", ":", "result", "=", "newsims", "or", "[", "]", "elif", "newsims", "is", "None", ":", "result", "=", "oldsims", "else", ":", "resul...
Merge two precomputed similarity lists, truncating the result to `clip` most similar items.
[ "Merge", "two", "precomputed", "similarity", "lists", "truncating", "the", "result", "to", "clip", "most", "similar", "items", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L49-L59
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.terminate
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) ...
python
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", ")", ":", "try", ":", "self", ".", "id2sims", ".", "terminate", "(", ")", "except", ":", "pass", "import", "glob", "for", "fname", "in", "glob", ".", "glob", "(", "self", ".", "fname", "+", "'*'", ")", ":", "try", ...
Delete all files created by this index, invalidating `self`. Use with care.
[ "Delete", "all", "files", "created", "by", "this", "index", "invalidating", "self", ".", "Use", "with", "care", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L120-L137
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.index_documents
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...
python
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", ")", ":", "docids", "=", "fresh_docs", ".", "keys", "(", ")", "vectors", "=", "(", "model", ".", "docs2vecs", "(", "fresh_docs", "[", "docid", "]", "for", "docid", "in", "docids", ...
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.
[ "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", ")...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L140-L151
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.update_ids
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: ...
python
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", ")", ":", "logger", ".", "info", "(", "\"updating %i id mappings\"", "%", "len", "(", "docids", ")", ")", "for", "docid", "in", "docids", ":", "if", "docid", "is", "not", "None", ":", "pos", "=", "self",...
Update id->pos mapping with new document ids.
[ "Update", "id", "-", ">", "pos", "mapping", "with", "new", "document", "ids", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L154-L170
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.update_mappings
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"
python
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", ")", ":", "self", ".", "pos2id", "=", "dict", "(", "(", "v", ",", "k", ")", "for", "k", ",", "v", "in", "self", ".", "id2pos", ".", "iteritems", "(", ")", ")", "assert", "len", "(", "self", ".", "pos2id", ...
Synchronize id<->position mappings.
[ "Synchronize", "id<", "-", ">", "position", "mappings", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L173-L176
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.delete
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 ...
python
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", ")", ":", "logger", ".", "debug", "(", "\"deleting %i documents from %s\"", "%", "(", "len", "(", "docids", ")", ",", "self", ")", ")", "deleted", "=", "0", "for", "docid", "in", "docids", ":", "try", ":", ...
Delete documents (specified by their ids) from the index.
[ "Delete", "documents", "(", "specified", "by", "their", "ids", ")", "from", "the", "index", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L179-L193
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.sims2scores
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...
python
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", ")", ":", "result", "=", "[", "]", "if", "isinstance", "(", "sims", ",", "numpy", ".", "ndarray", ")", ":", "sims", "=", "abs", "(", "sims", ")", "# TODO or maybe clip? are opposi...
Convert raw similarity vector to a list of (docid, similarity) results.
[ "Convert", "raw", "similarity", "vector", "to", "a", "list", "of", "(", "docid", "similarity", ")", "results", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L196-L214
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.vec_by_id
def vec_by_id(self, docid): """Return indexed vector corresponding to document `docid`.""" pos = self.id2pos[docid] return self.qindex.vector_by_id(pos)
python
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", ")", ":", "pos", "=", "self", ".", "id2pos", "[", "docid", "]", "return", "self", ".", "qindex", ".", "vector_by_id", "(", "pos", ")" ]
Return indexed vector corresponding to document `docid`.
[ "Return", "indexed", "vector", "corresponding", "to", "document", "docid", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L217-L220
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.sims_by_id
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]) ...
python
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", ")", ":", "result", "=", "self", ".", "id2sims", ".", "get", "(", "docid", ",", "None", ")", "if", "result", "is", "None", ":", "self", ".", "qindex", ".", "num_best", "=", "self", ".", "topsims", "si...
Find the most similar documents to the (already indexed) document with `docid`.
[ "Find", "the", "most", "similar", "documents", "to", "the", "(", "already", "indexed", ")", "document", "with", "docid", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L223-L230
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.sims_by_vec
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...
python
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", ")", ":", "if", "normalize", "is", "None", ":", "normalize", "=", "self", ".", "qindex", ".", "normalize", "norm", ",", "self", ".", "qindex", ".", "normalize", "=", "self", ...
Find the most similar documents to a given vector (=already processed document).
[ "Find", "the", "most", "similar", "documents", "to", "a", "given", "vector", "(", "=", "already", "processed", "document", ")", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L233-L243
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimIndex.merge
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...
python
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", ")", ":", "other", ".", "qindex", ".", "normalize", ",", "other", ".", "qindex", ".", "num_best", "=", "False", ",", "self", ".", "topsims", "# update precomputed \"most similar\" for old documents (in case some of", "# t...
Merge documents from the other index. Update precomputed similarities in the process.
[ "Merge", "documents", "from", "the", "other", "index", ".", "Update", "precomputed", "similarities", "in", "the", "process", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L246-L291
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimModel.doc2vec
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...
python
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", ")", ":", "bow", "=", "self", ".", "dictionary", ".", "doc2bow", "(", "doc", "[", "'tokens'", "]", ")", "if", "self", ".", "method", "==", "'lsi'", ":", "return", "self", ".", "lsi", "[", "self", ".", "t...
Convert a single SimilarityDocument to vector.
[ "Convert", "a", "single", "SimilarityDocument", "to", "vector", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L385-L395
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimModel.docs2vecs
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...
python
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", ")", ":", "bows", "=", "(", "self", ".", "dictionary", ".", "doc2bow", "(", "doc", "[", "'tokens'", "]", ")", "for", "doc", "in", "docs", ")", "if", "self", ".", "method", "==", "'lsi'", ":", "return", ...
Convert multiple SimilarityDocuments to vectors (batch version of doc2vec).
[ "Convert", "multiple", "SimilarityDocuments", "to", "vectors", "(", "batch", "version", "of", "doc2vec", ")", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L398-L408
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.flush
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: ...
python
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", ")", ":", "if", "save_index", ":", "if", "self", ".", "fresh_index", "is", "not", "None", ":", "self", ".", "fresh_index", ...
Commit all changes, clear all caches.
[ "Commit", "all", "changes", "clear", "all", "caches", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L481-L499
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.close
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...
python
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", ")", ":", "try", ":", "self", ".", "payload", ".", "close", "(", ")", "except", ":", "pass", "try", ":", "self", ".", "model", ".", "close", "(", ")", "except", ":", "pass", "try", ":", "self", ".", "fresh_index", "."...
Explicitly close open file handles, databases etc.
[ "Explicitly", "close", "open", "file", "handles", "databases", "etc", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L502-L523
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.buffer
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...
python
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", ")", ":", "logger", ".", "info", "(", "\"adding documents to temporary buffer of %s\"", "%", "(", "self", ")", ")", "for", "doc", "in", "documents", ":", "docid", "=", "doc", "[", "'id'", "]", "# log...
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...
[ "Add", "a", "sequence", "of", "documents", "to", "be", "processed", "(", "indexed", "or", "trained", "on", ")", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L530-L552
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.train
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...
python
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", ")", ":", "if", "corpus", "is", "not", "None", ":", "# use the supplied corpus only (erase existing buffer, if ...
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.
[ "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", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L556-L583
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.index
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...
python
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", ")", ":", "if", "not", "self", ".", "model", ":", "msg", "=", "'must initialize model for %s before indexing documents'", "%", "self", ".", "basename", "logger", ".", ...
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.
[ "Permanently", "index", "all", "documents", "previously", "added", "via", "buffer", "or", "directly", "index", "documents", "from", "corpus", "if", "specified", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L587-L623
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.optimize
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...
python
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", ")", ":", "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", "...
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 ...
[ "Precompute", "top", "similarities", "for", "all", "indexed", "documents", ".", "This", "speeds", "up", "find_similar", "queries", "by", "id", "(", "but", "not", "queries", "by", "fulltext", ")", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L627-L652
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.drop_index
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...
python
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", ")", ":", "modelstr", "=", "\"\"", "if", "keep_model", "else", "\"and model \"", "logger", ".", "info", "(", "\"deleting similarity index \"", "+", "modelstr", "+", "\"from %s\"", "%", "self", "...
Drop all indexed documents. If `keep_model` is False, also dropped the model.
[ "Drop", "all", "indexed", "documents", ".", "If", "keep_model", "is", "False", "also", "dropped", "the", "model", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L656-L691
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.delete
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)
python
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", ")", ":", "logger", ".", "info", "(", "\"asked to drop %i documents\"", "%", "len", "(", "docids", ")", ")", "for", "index", "in", "[", "self", ".", "opt_index", ",", "self", ".", "fresh_index", "]", ":", "i...
Delete specified documents from the index.
[ "Delete", "specified", "documents", "from", "the", "index", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L695-L701
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.find_similar
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...
python
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", ")", ":", "logger", ".", "debug", "(", "\"received query call with %r\"", "%", "doc", ")", "if", "self", ".", "is_locked", "(", ")", ":", "msg",...
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...
[ "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",...
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L714-L773
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SimServer.keys
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
python
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", ")", ":", "result", "=", "[", "]", "if", "self", ".", "fresh_index", "is", "not", "None", ":", "result", "+=", "self", ".", "fresh_index", ".", "keys", "(", ")", "if", "self", ".", "opt_index", "is", "not", "None", ":", ...
Return ids of all indexed documents.
[ "Return", "ids", "of", "all", "indexed", "documents", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L799-L806
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.check_session
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...
python
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", ")", ":", "if", "self", ".", "session", "is", "None", ":", "if", "self", ".", "autosession", ":", "self", ".", "open_session", "(", ")", "else", ":", "msg", "=", "\"must open a session before modifying %s\"", "%", "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.
[ "Make", "sure", "a", "session", "is", "open", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L876-L888
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.open_session
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 ...
python
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", ")", ":", "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...
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.
[ "Open", "a", "new", "session", "to", "modify", "this", "server", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L891-L913
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.buffer
def buffer(self, *args, **kwargs): """Buffer documents, in the current session""" self.check_session() result = self.session.buffer(*args, **kwargs) return result
python
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", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "buffer", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "result" ]
Buffer documents, in the current session
[ "Buffer", "documents", "in", "the", "current", "session" ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L916-L920
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.index
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
python
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", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "index", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "self", ".", "a...
Index documents, in the current session
[ "Index", "documents", "in", "the", "current", "session" ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L923-L929
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.drop_index
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
python
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", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "drop_index", "(", "keep_model", ")", "if", "self", ".", "autosession", ":", "self", ".", "c...
Drop all indexed documents from the session. Optionally, drop model too.
[ "Drop", "all", "indexed", "documents", "from", "the", "session", ".", "Optionally", "drop", "model", "too", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L941-L947
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.delete
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
python
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", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "delete", "(", "docids", ")", "if", "self", ".", "autosession", ":", "self", ".", "commit", "(", ")", "return",...
Delete documents from the current session.
[ "Delete", "documents", "from", "the", "current", "session", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L950-L956
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.optimize
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
python
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", ")", ":", "self", ".", "check_session", "(", ")", "result", "=", "self", ".", "session", ".", "optimize", "(", ")", "if", "self", ".", "autosession", ":", "self", ".", "commit", "(", ")", "return", "result" ]
Optimize index for faster by-document-id queries.
[ "Optimize", "index", "for", "faster", "by", "-", "document", "-", "id", "queries", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L959-L965
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.commit
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 ...
python
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", ")", ":", "if", "self", ".", "session", "is", "not", "None", ":", "logger", ".", "info", "(", "\"committing transaction in %s\"", "%", "self", ")", "tmp", "=", "self", ".", "stable", "self", ".", "stable", ",", "self", "."...
Commit changes made by the latest session.
[ "Commit", "changes", "made", "by", "the", "latest", "session", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L973-L984
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.rollback
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...
python
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", ")", ":", "if", "self", ".", "session", "is", "not", "None", ":", "logger", ".", "info", "(", "\"rolling back transaction in %s\"", "%", "self", ")", "self", ".", "session", ".", "close", "(", ")", "self", ".", "session", ...
Ignore all changes made in the latest session (terminate the session).
[ "Ignore", "all", "changes", "made", "in", "the", "latest", "session", "(", "terminate", "the", "session", ")", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L987-L995
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.set_autosession
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...
python
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", ")", ":", "if", "value", "is", "not", "None", ":", "self", ".", "rollback", "(", ")", "self", ".", "autosession", "=", "value", "return", "self", ".", "autosession" ]
Turn autosession (automatic committing after each modification call) on/off. If value is None, only query the current value (don't change anything).
[ "Turn", "autosession", "(", "automatic", "committing", "after", "each", "modification", "call", ")", "on", "/", "off", ".", "If", "value", "is", "None", "only", "query", "the", "current", "value", "(", "don", "t", "change", "anything", ")", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L998-L1006
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.terminate
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) ...
python
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", ")", ":", "logger", ".", "info", "(", "\"deleting entire server %s\"", "%", "self", ")", "self", ".", "close", "(", ")", "try", ":", "shutil", ".", "rmtree", "(", "self", ".", "basedir", ")", "logger", ".", "info", "(",...
Delete all files created by this server, invalidating `self`. Use with care.
[ "Delete", "all", "files", "created", "by", "this", "server", "invalidating", "self", ".", "Use", "with", "care", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L1024-L1039
train
RaRe-Technologies/gensim-simserver
simserver/simserver.py
SessionServer.find_similar
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...
python
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", ")", ":", "if", "self", ".", "session", "is", "not", "None", "and", "self", ".", "autosession", ":", "# with autosession on, commit the pending transaction first", "self", ".", "com...
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).
[ "Find", "similar", "articles", "." ]
e7e59e836ef6d9da019a8c6b218ef0bdd998b2da
https://github.com/RaRe-Technologies/gensim-simserver/blob/e7e59e836ef6d9da019a8c6b218ef0bdd998b2da/simserver/simserver.py#L1042-L1054
train
cree-py/pynite
examples/discord.py
Fortnite.profile
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))
python
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", ")", ":", "player", "=", "await", "self", ".", "client", ".", "get_player", "(", "platform", ",", "name", ")", "solos", "=", "await", "player", ".", "get_solos", "(", "...
Fetch a profile.
[ "Fetch", "a", "profile", "." ]
91424c912a23d2b93bda1f017703e492572134c6
https://github.com/cree-py/pynite/blob/91424c912a23d2b93bda1f017703e492572134c6/examples/discord.py#L22-L28
train
anti1869/aiohttp_autoreload
src/aiohttp_autoreload.py
start
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) >...
python
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", ")", ":", "io_loop", "=", "io_loop", "or", "asyncio", ".", "get_event_loop", "(", ")", "if", "io_loop", "in", "_io_loops", ":", "return", "_io_loops", "[", "io_loop", "]", "=", "...
Begins watching source files for changes. .. versionchanged:: 4.1 The ``io_loop`` argument is deprecated.
[ "Begins", "watching", "source", "files", "for", "changes", "." ]
1d9b9b67ffba1073fa35495d87538b4570807367
https://github.com/anti1869/aiohttp_autoreload/blob/1d9b9b67ffba1073fa35495d87538b4570807367/src/aiohttp_autoreload.py#L58-L76
train
google/dotty
efilter/protocols/reducer.py
generate_chunks
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
python
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", ")", ":", "iterator", "=", "iter", "(", "repeated", ".", "getvalues", "(", "data", ")", ")", "while", "True", ":", "chunk", "=", "list", "(", "itertools", ".", "islice", ...
Yield 'chunk_size' items from 'data' at a time.
[ "Yield", "chunk_size", "items", "from", "data", "at", "a", "time", "." ]
b145131499be0c4b755fc2e2ac19be11a50bce6a
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/protocols/reducer.py#L58-L67
train
google/dotty
efilter/protocols/reducer.py
reduce
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 ...
python
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", ")", ":", "if", "not", "chunk_size", ":", "return", "finalize", "(", "reducer", ",", "fold", "(", "reducer", ",", "data", ")", ")", "# Splitting the work up into chunks...
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.
[ "Repeatedly", "call", "fold", "and", "merge", "on", "data", "and", "then", "finalize", "." ]
b145131499be0c4b755fc2e2ac19be11a50bce6a
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/protocols/reducer.py#L70-L92
train
google/dotty
efilter/ast.py
IfElse.conditions
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])
python
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", ")", ":", "for", "idx", "in", "six", ".", "moves", ".", "range", "(", "1", ",", "len", "(", "self", ".", "children", ")", ",", "2", ")", ":", "yield", "(", "self", ".", "children", "[", "idx", "-", "1", "]", ...
The if-else pairs.
[ "The", "if", "-", "else", "pairs", "." ]
b145131499be0c4b755fc2e2ac19be11a50bce6a
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/ast.py#L415-L418
train
radical-cybertools/radical.entk
src/radical/entk/execman/rp/task_processor.py
resolve_placeholders
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...
python
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", ")", ":", "try", ":", "if", "isinstance", "(", "path", ",", "unicode", ")", ":", "path", "=", "str", "(", "path", ")", "if", "not", "isinstance", "(", "path", ",", "str", ")", ":", ...
**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
[ "**", "Purpose", "**", ":", "Substitute", "placeholders", "in", "staging", "attributes", "of", "a", "Task", "with", "actual", "paths", "to", "the", "corresponding", "tasks", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L10-L91
train
radical-cybertools/radical.entk
src/radical/entk/execman/rp/task_processor.py
get_input_list_from_task
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...
python
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", ")", ":", "try", ":", "if", "not", "isinstance", "(", "task", ",", "Task", ")", ":", "raise", "TypeError", "(", "expected_type", "=", "Task", ",", "actual_type", "=", "type", "(", "ta...
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 ...
[ "Purpose", ":", "Parse", "a", "Task", "object", "to", "extract", "the", "files", "to", "be", "staged", "as", "the", "output", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L156-L265
train
radical-cybertools/radical.entk
src/radical/entk/execman/rp/task_processor.py
get_output_list_from_task
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...
python
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", ")", ":", "try", ":", "if", "not", "isinstance", "(", "task", ",", "Task", ")", ":", "raise", "TypeError", "(", "expected_type", "=", "Task", ",", "actual_type", "=", "type", "(", "t...
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 ...
[ "Purpose", ":", "Parse", "a", "Task", "object", "to", "extract", "the", "files", "to", "be", "staged", "as", "the", "output", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L268-L357
train
radical-cybertools/radical.entk
src/radical/entk/execman/rp/task_processor.py
create_cud_from_task
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:...
python
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", ")", ":", "try", ":", "logger", ".", "debug", "(", "'Creating CU from Task %s'", "%", "(", "task", ".", "uid", ")", ")", "if", "prof", ":", "prof", ".", "prof"...
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
[ "Purpose", ":", "Create", "a", "Compute", "Unit", "description", "based", "on", "the", "defined", "Task", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L360-L420
train
radical-cybertools/radical.entk
src/radical/entk/execman/rp/task_processor.py
create_task_from_cu
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...
python
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", ")", ":", "try", ":", "logger", ".", "debug", "(", "'Create Task from CU %s'", "%", "cu", ".", "name", ")", "if", "prof", ":", "prof", ".", "prof", "(", "'task from cu - create'", ",", "u...
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...
[ "Purpose", ":", "Create", "a", "Task", "based", "on", "the", "Compute", "Unit", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/execman/rp/task_processor.py#L423-L472
train
bradmontgomery/django-redis-metrics
redis_metrics/management/commands/redis_metrics_send_mail.py
Command.handle_noargs
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] = [] ...
python
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", ")", ":", "r", "=", "get_r", "(", ")", "since", "=", "datetime", ".", "utcnow", "(", ")", "-", "timedelta", "(", "days", "=", "1", ")", "metrics", "=", "{", "}", "categories", "=", "r...
Send Report E-mails.
[ "Send", "Report", "E", "-", "mails", "." ]
2c92332920113d28c39234b949aa496b39a091d1
https://github.com/bradmontgomery/django-redis-metrics/blob/2c92332920113d28c39234b949aa496b39a091d1/redis_metrics/management/commands/redis_metrics_send_mail.py#L16-L54
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage.luid
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') ...
python
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", ")", ":", "p_elem", "=", "self", ".", "parent_pipeline", ".", "get", "(", "'name'", ")", "if", "not", "p_elem", ":", "p_elem", "=", "self", ".", "parent_pipeline", "[", "'uid'", "]", "s_elem", "=", "self", ".", "name", "if...
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
[ "Unique", "ID", "of", "the", "current", "stage", "(", "fully", "qualified", ")", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L92-L111
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage.add_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)
python
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", ")", ":", "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 :argument: set of tasks
[ "Adds", "tasks", "to", "the", "existing", "set", "of", "tasks", "of", "the", "Stage" ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L201-L209
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage.to_dict
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...
python
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", ")", ":", "stage_desc_as_dict", "=", "{", "'uid'", ":", "self", ".", "_uid", ",", "'name'", ":", "self", ".", "_name", ",", "'state'", ":", "self", ".", "_state", ",", "'state_history'", ":", "self", ".", "_state_history", ...
Convert current Stage into a dictionary :return: python dictionary
[ "Convert", "current", "Stage", "into", "a", "dictionary" ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L211-L227
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage.from_dict
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']: ...
python
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", ")", ":", "if", "'uid'", "in", "d", ":", "if", "d", "[", "'uid'", "]", ":", "self", ".", "_uid", "=", "d", "[", "'uid'", "]", "if", "'name'", "in", "d", ":", "if", "d", "[", "'name'", "]", ":", "se...
Create a Stage from a dictionary. The change is in inplace. :argument: python dictionary :return: None
[ "Create", "a", "Stage", "from", "a", "dictionary", ".", "The", "change", "is", "in", "inplace", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L229-L270
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage._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', ...
python
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", ")", ":", "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. :arguments: String
[ "Purpose", ":", "Set", "state", "of", "all", "tasks", "of", "the", "current", "stage", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L276-L289
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage._check_stage_complete
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...
python
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", ")", ":", "try", ":", "for", "task", "in", "self", ".", "_tasks", ":", "if", "task", ".", "state", "not", "in", "[", "states", ".", "DONE", ",", "states", ".", "FAILED", "]", ":", "return", "False", "retur...
Purpose: Check if all tasks of the current stage have completed, i.e., are in either DONE or FAILED state.
[ "Purpose", ":", "Check", "if", "all", "tasks", "of", "the", "current", "stage", "have", "completed", "i", ".", "e", ".", "are", "in", "either", "DONE", "or", "FAILED", "state", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L291-L305
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage._validate_entities
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...
python
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", ")", ":", "if", "not", "tasks", ":", "raise", "TypeError", "(", "expected_type", "=", "Task", ",", "actual_type", "=", "type", "(", "tasks", ")", ")", "if", "not", "isinstance", "(", "tasks", ",", ...
Purpose: Validate whether the 'tasks' is of type set. Validate the description of each Task.
[ "Purpose", ":", "Validate", "whether", "the", "tasks", "is", "of", "type", "set", ".", "Validate", "the", "description", "of", "each", "Task", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L308-L328
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage._assign_uid
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: ...
python
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", ")", ":", "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
[ "Purpose", ":", "Assign", "a", "uid", "to", "the", "current", "object", "based", "on", "the", "sid", "passed", ".", "Pass", "the", "current", "uid", "to", "children", "of", "current", "object" ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L351-L360
train
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage._pass_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 ...
python
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", ")", ":", "for", "task", "in", "self", ".", "_tasks", ":", "task", ".", "parent_stage", "[", "'uid'", "]", "=", "self", ".", "_uid", "task", ".", "parent_stage", "[", "'name'", "]", "=", "self", ".", "_name", "task", ...
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
[ "Purpose", ":", "Assign", "the", "parent", "Stage", "and", "the", "parent", "Pipeline", "to", "all", "the", "tasks", "of", "the", "current", "stage", "." ]
945f6c93c9a62db90ad191b306418d5c1cdd9d24
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L362-L374
train