id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
6,700
konstantint/PassportEye
passporteye/mrz/image.py
read_mrz
def read_mrz(file, save_roi=False, extra_cmdline_params=''): """The main interface function to this module, encapsulating the recognition pipeline. Given an image filename, runs MRZPipeline on it, returning the parsed MRZ object. :param file: A filename or a stream to read the file data from. :param...
python
def read_mrz(file, save_roi=False, extra_cmdline_params=''): """The main interface function to this module, encapsulating the recognition pipeline. Given an image filename, runs MRZPipeline on it, returning the parsed MRZ object. :param file: A filename or a stream to read the file data from. :param...
[ "def", "read_mrz", "(", "file", ",", "save_roi", "=", "False", ",", "extra_cmdline_params", "=", "''", ")", ":", "p", "=", "MRZPipeline", "(", "file", ",", "extra_cmdline_params", ")", "mrz", "=", "p", ".", "result", "if", "mrz", "is", "not", "None", "...
The main interface function to this module, encapsulating the recognition pipeline. Given an image filename, runs MRZPipeline on it, returning the parsed MRZ object. :param file: A filename or a stream to read the file data from. :param save_roi: when this is True, the .aux['roi'] field will contain the...
[ "The", "main", "interface", "function", "to", "this", "module", "encapsulating", "the", "recognition", "pipeline", ".", "Given", "an", "image", "filename", "runs", "MRZPipeline", "on", "it", "returning", "the", "parsed", "MRZ", "object", "." ]
b32afba0f5dc4eb600c4edc4f49e5d49959c5415
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/mrz/image.py#L328-L343
6,701
konstantint/PassportEye
passporteye/mrz/image.py
Loader._imread
def _imread(self, file): """Proxy to skimage.io.imread with some fixes.""" # For now, we have to select the imageio plugin to read image from byte stream # When ski-image v0.15 is released, imageio will be the default plugin, so this # code can be simplified at that time. See issue repo...
python
def _imread(self, file): """Proxy to skimage.io.imread with some fixes.""" # For now, we have to select the imageio plugin to read image from byte stream # When ski-image v0.15 is released, imageio will be the default plugin, so this # code can be simplified at that time. See issue repo...
[ "def", "_imread", "(", "self", ",", "file", ")", ":", "# For now, we have to select the imageio plugin to read image from byte stream", "# When ski-image v0.15 is released, imageio will be the default plugin, so this", "# code can be simplified at that time. See issue report and pull request:",...
Proxy to skimage.io.imread with some fixes.
[ "Proxy", "to", "skimage", ".", "io", ".", "imread", "with", "some", "fixes", "." ]
b32afba0f5dc4eb600c4edc4f49e5d49959c5415
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/mrz/image.py#L30-L41
6,702
konstantint/PassportEye
passporteye/mrz/image.py
MRZBoxLocator._are_aligned_angles
def _are_aligned_angles(self, b1, b2): "Are two boxes aligned according to their angle?" return abs(b1 - b2) <= self.angle_tol or abs(np.pi - abs(b1 - b2)) <= self.angle_tol
python
def _are_aligned_angles(self, b1, b2): "Are two boxes aligned according to their angle?" return abs(b1 - b2) <= self.angle_tol or abs(np.pi - abs(b1 - b2)) <= self.angle_tol
[ "def", "_are_aligned_angles", "(", "self", ",", "b1", ",", "b2", ")", ":", "return", "abs", "(", "b1", "-", "b2", ")", "<=", "self", ".", "angle_tol", "or", "abs", "(", "np", ".", "pi", "-", "abs", "(", "b1", "-", "b2", ")", ")", "<=", "self", ...
Are two boxes aligned according to their angle?
[ "Are", "two", "boxes", "aligned", "according", "to", "their", "angle?" ]
b32afba0f5dc4eb600c4edc4f49e5d49959c5415
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/mrz/image.py#L136-L138
6,703
konstantint/PassportEye
passporteye/mrz/image.py
MRZBoxLocator._are_nearby_parallel_boxes
def _are_nearby_parallel_boxes(self, b1, b2): "Are two boxes nearby, parallel, and similar in width?" if not self._are_aligned_angles(b1.angle, b2.angle): return False # Otherwise pick the smaller angle and see whether the two boxes are close according to the "up" direction wrt that ...
python
def _are_nearby_parallel_boxes(self, b1, b2): "Are two boxes nearby, parallel, and similar in width?" if not self._are_aligned_angles(b1.angle, b2.angle): return False # Otherwise pick the smaller angle and see whether the two boxes are close according to the "up" direction wrt that ...
[ "def", "_are_nearby_parallel_boxes", "(", "self", ",", "b1", ",", "b2", ")", ":", "if", "not", "self", ".", "_are_aligned_angles", "(", "b1", ".", "angle", ",", "b2", ".", "angle", ")", ":", "return", "False", "# Otherwise pick the smaller angle and see whether ...
Are two boxes nearby, parallel, and similar in width?
[ "Are", "two", "boxes", "nearby", "parallel", "and", "similar", "in", "width?" ]
b32afba0f5dc4eb600c4edc4f49e5d49959c5415
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/mrz/image.py#L140-L147
6,704
konstantint/PassportEye
passporteye/mrz/image.py
MRZBoxLocator._merge_any_two_boxes
def _merge_any_two_boxes(self, box_list): """Given a list of boxes, finds two nearby parallel ones and merges them. Returns false if none found.""" n = len(box_list) for i in range(n): for j in range(i + 1, n): if self._are_nearby_parallel_boxes(box_list[i], box_list[...
python
def _merge_any_two_boxes(self, box_list): """Given a list of boxes, finds two nearby parallel ones and merges them. Returns false if none found.""" n = len(box_list) for i in range(n): for j in range(i + 1, n): if self._are_nearby_parallel_boxes(box_list[i], box_list[...
[ "def", "_merge_any_two_boxes", "(", "self", ",", "box_list", ")", ":", "n", "=", "len", "(", "box_list", ")", "for", "i", "in", "range", "(", "n", ")", ":", "for", "j", "in", "range", "(", "i", "+", "1", ",", "n", ")", ":", "if", "self", ".", ...
Given a list of boxes, finds two nearby parallel ones and merges them. Returns false if none found.
[ "Given", "a", "list", "of", "boxes", "finds", "two", "nearby", "parallel", "ones", "and", "merges", "them", ".", "Returns", "false", "if", "none", "found", "." ]
b32afba0f5dc4eb600c4edc4f49e5d49959c5415
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/mrz/image.py#L149-L164
6,705
konstantint/PassportEye
passporteye/mrz/image.py
BoxToMRZ._try_larger_image
def _try_larger_image(self, roi, cur_text, cur_mrz, filter_order=3): """Attempts to improve the OCR result by scaling the image. If the new mrz is better, returns it, otherwise returns the old mrz.""" if roi.shape[1] <= 700: scale_by = int(1050.0 / roi.shape[1] + 0.5) roi...
python
def _try_larger_image(self, roi, cur_text, cur_mrz, filter_order=3): """Attempts to improve the OCR result by scaling the image. If the new mrz is better, returns it, otherwise returns the old mrz.""" if roi.shape[1] <= 700: scale_by = int(1050.0 / roi.shape[1] + 0.5) roi...
[ "def", "_try_larger_image", "(", "self", ",", "roi", ",", "cur_text", ",", "cur_mrz", ",", "filter_order", "=", "3", ")", ":", "if", "roi", ".", "shape", "[", "1", "]", "<=", "700", ":", "scale_by", "=", "int", "(", "1050.0", "/", "roi", ".", "shap...
Attempts to improve the OCR result by scaling the image. If the new mrz is better, returns it, otherwise returns the old mrz.
[ "Attempts", "to", "improve", "the", "OCR", "result", "by", "scaling", "the", "image", ".", "If", "the", "new", "mrz", "is", "better", "returns", "it", "otherwise", "returns", "the", "old", "mrz", "." ]
b32afba0f5dc4eb600c4edc4f49e5d49959c5415
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/mrz/image.py#L254-L267
6,706
konstantint/PassportEye
passporteye/mrz/scripts.py
mrz
def mrz(): """ Command-line script for extracting MRZ from a given image """ parser = argparse.ArgumentParser(description='Run the MRZ OCR recognition algorithm on the given image.') parser.add_argument('filename') parser.add_argument('--json', action='store_true', help='Produce JSON (rather tha...
python
def mrz(): """ Command-line script for extracting MRZ from a given image """ parser = argparse.ArgumentParser(description='Run the MRZ OCR recognition algorithm on the given image.') parser.add_argument('filename') parser.add_argument('--json', action='store_true', help='Produce JSON (rather tha...
[ "def", "mrz", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Run the MRZ OCR recognition algorithm on the given image.'", ")", "parser", ".", "add_argument", "(", "'filename'", ")", "parser", ".", "add_argument", "(", "'-...
Command-line script for extracting MRZ from a given image
[ "Command", "-", "line", "script", "for", "extracting", "MRZ", "from", "a", "given", "image" ]
b32afba0f5dc4eb600c4edc4f49e5d49959c5415
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/mrz/scripts.py#L134-L174
6,707
glitchassassin/lackey
lackey/PlatformManagerWindows.py
PlatformManagerWindows._check_count
def _check_count(self, result, func, args): #pylint: disable=unused-argument """ Private function to return ctypes errors cleanly """ if result == 0: raise ctypes.WinError(ctypes.get_last_error()) return args
python
def _check_count(self, result, func, args): #pylint: disable=unused-argument """ Private function to return ctypes errors cleanly """ if result == 0: raise ctypes.WinError(ctypes.get_last_error()) return args
[ "def", "_check_count", "(", "self", ",", "result", ",", "func", ",", "args", ")", ":", "#pylint: disable=unused-argument", "if", "result", "==", "0", ":", "raise", "ctypes", ".", "WinError", "(", "ctypes", ".", "get_last_error", "(", ")", ")", "return", "a...
Private function to return ctypes errors cleanly
[ "Private", "function", "to", "return", "ctypes", "errors", "cleanly" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L210-L215
6,708
glitchassassin/lackey
lackey/PlatformManagerWindows.py
PlatformManagerWindows._getMonitorInfo
def _getMonitorInfo(self): """ Returns info about the attached monitors, in device order [0] is always the primary monitor """ monitors = [] CCHDEVICENAME = 32 def _MonitorEnumProcCallback(hMonitor, hdcMonitor, lprcMonitor, dwData): class MONITORINFOEX(ctypes...
python
def _getMonitorInfo(self): """ Returns info about the attached monitors, in device order [0] is always the primary monitor """ monitors = [] CCHDEVICENAME = 32 def _MonitorEnumProcCallback(hMonitor, hdcMonitor, lprcMonitor, dwData): class MONITORINFOEX(ctypes...
[ "def", "_getMonitorInfo", "(", "self", ")", ":", "monitors", "=", "[", "]", "CCHDEVICENAME", "=", "32", "def", "_MonitorEnumProcCallback", "(", "hMonitor", ",", "hdcMonitor", ",", "lprcMonitor", ",", "dwData", ")", ":", "class", "MONITORINFOEX", "(", "ctypes",...
Returns info about the attached monitors, in device order [0] is always the primary monitor
[ "Returns", "info", "about", "the", "attached", "monitors", "in", "device", "order" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L401-L443
6,709
glitchassassin/lackey
lackey/PlatformManagerWindows.py
PlatformManagerWindows._getVirtualScreenRect
def _getVirtualScreenRect(self): """ The virtual screen is the bounding box containing all monitors. Not all regions in the virtual screen are actually visible. The (0,0) coordinate is the top left corner of the primary screen rather than the whole bounding box, so some regions of the v...
python
def _getVirtualScreenRect(self): """ The virtual screen is the bounding box containing all monitors. Not all regions in the virtual screen are actually visible. The (0,0) coordinate is the top left corner of the primary screen rather than the whole bounding box, so some regions of the v...
[ "def", "_getVirtualScreenRect", "(", "self", ")", ":", "SM_XVIRTUALSCREEN", "=", "76", "# Left of virtual screen", "SM_YVIRTUALSCREEN", "=", "77", "# Top of virtual screen", "SM_CXVIRTUALSCREEN", "=", "78", "# Width of virtual screen", "SM_CYVIRTUALSCREEN", "=", "79", "# He...
The virtual screen is the bounding box containing all monitors. Not all regions in the virtual screen are actually visible. The (0,0) coordinate is the top left corner of the primary screen rather than the whole bounding box, so some regions of the virtual screen may have negative coordinates i...
[ "The", "virtual", "screen", "is", "the", "bounding", "box", "containing", "all", "monitors", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L444-L462
6,710
glitchassassin/lackey
lackey/PlatformManagerWindows.py
PlatformManagerWindows.osPaste
def osPaste(self): """ Triggers the OS "paste" keyboard shortcut """ from .InputEmulation import Keyboard k = Keyboard() k.keyDown("{CTRL}") k.type("v") k.keyUp("{CTRL}")
python
def osPaste(self): """ Triggers the OS "paste" keyboard shortcut """ from .InputEmulation import Keyboard k = Keyboard() k.keyDown("{CTRL}") k.type("v") k.keyUp("{CTRL}")
[ "def", "osPaste", "(", "self", ")", ":", "from", ".", "InputEmulation", "import", "Keyboard", "k", "=", "Keyboard", "(", ")", "k", ".", "keyDown", "(", "\"{CTRL}\"", ")", "k", ".", "type", "(", "\"v\"", ")", "k", ".", "keyUp", "(", "\"{CTRL}\"", ")" ...
Triggers the OS "paste" keyboard shortcut
[ "Triggers", "the", "OS", "paste", "keyboard", "shortcut" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L497-L503
6,711
glitchassassin/lackey
lackey/PlatformManagerWindows.py
PlatformManagerWindows.focusWindow
def focusWindow(self, hwnd): """ Brings specified window to the front """ Debug.log(3, "Focusing window: " + str(hwnd)) SW_RESTORE = 9 if ctypes.windll.user32.IsIconic(hwnd): ctypes.windll.user32.ShowWindow(hwnd, SW_RESTORE) ctypes.windll.user32.SetForegroundWindow(hw...
python
def focusWindow(self, hwnd): """ Brings specified window to the front """ Debug.log(3, "Focusing window: " + str(hwnd)) SW_RESTORE = 9 if ctypes.windll.user32.IsIconic(hwnd): ctypes.windll.user32.ShowWindow(hwnd, SW_RESTORE) ctypes.windll.user32.SetForegroundWindow(hw...
[ "def", "focusWindow", "(", "self", ",", "hwnd", ")", ":", "Debug", ".", "log", "(", "3", ",", "\"Focusing window: \"", "+", "str", "(", "hwnd", ")", ")", "SW_RESTORE", "=", "9", "if", "ctypes", ".", "windll", ".", "user32", ".", "IsIconic", "(", "hwn...
Brings specified window to the front
[ "Brings", "specified", "window", "to", "the", "front" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L557-L563
6,712
glitchassassin/lackey
lackey/PlatformManagerWindows.py
PlatformManagerWindows.isPIDValid
def isPIDValid(self, pid): """ Checks if a PID is associated with a running process """ ## Slightly copied wholesale from http://stackoverflow.com/questions/568271/how-to-check-if-there-exists-a-process-with-a-given-pid ## Thanks to http://stackoverflow.com/users/1777162/ntrrgc and http://stacko...
python
def isPIDValid(self, pid): """ Checks if a PID is associated with a running process """ ## Slightly copied wholesale from http://stackoverflow.com/questions/568271/how-to-check-if-there-exists-a-process-with-a-given-pid ## Thanks to http://stackoverflow.com/users/1777162/ntrrgc and http://stacko...
[ "def", "isPIDValid", "(", "self", ",", "pid", ")", ":", "## Slightly copied wholesale from http://stackoverflow.com/questions/568271/how-to-check-if-there-exists-a-process-with-a-given-pid", "## Thanks to http://stackoverflow.com/users/1777162/ntrrgc and http://stackoverflow.com/users/234270/speed...
Checks if a PID is associated with a running process
[ "Checks", "if", "a", "PID", "is", "associated", "with", "a", "running", "process" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L608-L635
6,713
glitchassassin/lackey
lackey/RegionMatching.py
Pattern.similar
def similar(self, similarity): """ Returns a new Pattern with the specified similarity threshold """ pattern = Pattern(self.path) pattern.similarity = similarity return pattern
python
def similar(self, similarity): """ Returns a new Pattern with the specified similarity threshold """ pattern = Pattern(self.path) pattern.similarity = similarity return pattern
[ "def", "similar", "(", "self", ",", "similarity", ")", ":", "pattern", "=", "Pattern", "(", "self", ".", "path", ")", "pattern", ".", "similarity", "=", "similarity", "return", "pattern" ]
Returns a new Pattern with the specified similarity threshold
[ "Returns", "a", "new", "Pattern", "with", "the", "specified", "similarity", "threshold" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L73-L77
6,714
glitchassassin/lackey
lackey/RegionMatching.py
Pattern.targetOffset
def targetOffset(self, dx, dy): """ Returns a new Pattern with the given target offset """ pattern = Pattern(self.path) pattern.similarity = self.similarity pattern.offset = Location(dx, dy) return pattern
python
def targetOffset(self, dx, dy): """ Returns a new Pattern with the given target offset """ pattern = Pattern(self.path) pattern.similarity = self.similarity pattern.offset = Location(dx, dy) return pattern
[ "def", "targetOffset", "(", "self", ",", "dx", ",", "dy", ")", ":", "pattern", "=", "Pattern", "(", "self", ".", "path", ")", "pattern", ".", "similarity", "=", "self", ".", "similarity", "pattern", ".", "offset", "=", "Location", "(", "dx", ",", "dy...
Returns a new Pattern with the given target offset
[ "Returns", "a", "new", "Pattern", "with", "the", "given", "target", "offset" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L88-L93
6,715
glitchassassin/lackey
lackey/RegionMatching.py
Pattern.debugPreview
def debugPreview(self, title="Debug"): """ Loads and displays the image at ``Pattern.path`` """ haystack = Image.open(self.path) haystack.show()
python
def debugPreview(self, title="Debug"): """ Loads and displays the image at ``Pattern.path`` """ haystack = Image.open(self.path) haystack.show()
[ "def", "debugPreview", "(", "self", ",", "title", "=", "\"Debug\"", ")", ":", "haystack", "=", "Image", ".", "open", "(", "self", ".", "path", ")", "haystack", ".", "show", "(", ")" ]
Loads and displays the image at ``Pattern.path``
[ "Loads", "and", "displays", "the", "image", "at", "Pattern", ".", "path" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L127-L130
6,716
glitchassassin/lackey
lackey/RegionMatching.py
Region.setLocation
def setLocation(self, location): """ Change the upper left-hand corner to a new ``Location`` Doesn't change width or height """ if not location or not isinstance(location, Location): raise ValueError("setLocation expected a Location object") self.x = location.x ...
python
def setLocation(self, location): """ Change the upper left-hand corner to a new ``Location`` Doesn't change width or height """ if not location or not isinstance(location, Location): raise ValueError("setLocation expected a Location object") self.x = location.x ...
[ "def", "setLocation", "(", "self", ",", "location", ")", ":", "if", "not", "location", "or", "not", "isinstance", "(", "location", ",", "Location", ")", ":", "raise", "ValueError", "(", "\"setLocation expected a Location object\"", ")", "self", ".", "x", "=", ...
Change the upper left-hand corner to a new ``Location`` Doesn't change width or height
[ "Change", "the", "upper", "left", "-", "hand", "corner", "to", "a", "new", "Location" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L222-L231
6,717
glitchassassin/lackey
lackey/RegionMatching.py
Region.contains
def contains(self, point_or_region): """ Checks if ``point_or_region`` is within this region """ if isinstance(point_or_region, Location): return (self.x < point_or_region.x < self.x + self.w) and (self.y < point_or_region.y < self.y + self.h) elif isinstance(point_or_region, Region)...
python
def contains(self, point_or_region): """ Checks if ``point_or_region`` is within this region """ if isinstance(point_or_region, Location): return (self.x < point_or_region.x < self.x + self.w) and (self.y < point_or_region.y < self.y + self.h) elif isinstance(point_or_region, Region)...
[ "def", "contains", "(", "self", ",", "point_or_region", ")", ":", "if", "isinstance", "(", "point_or_region", ",", "Location", ")", ":", "return", "(", "self", ".", "x", "<", "point_or_region", ".", "x", "<", "self", ".", "x", "+", "self", ".", "w", ...
Checks if ``point_or_region`` is within this region
[ "Checks", "if", "point_or_region", "is", "within", "this", "region" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L251-L261
6,718
glitchassassin/lackey
lackey/RegionMatching.py
Region.morphTo
def morphTo(self, region): """ Change shape of this region to match the given ``Region`` object """ if not region or not isinstance(region, Region): raise TypeError("morphTo expected a Region object") self.setROI(region) return self
python
def morphTo(self, region): """ Change shape of this region to match the given ``Region`` object """ if not region or not isinstance(region, Region): raise TypeError("morphTo expected a Region object") self.setROI(region) return self
[ "def", "morphTo", "(", "self", ",", "region", ")", ":", "if", "not", "region", "or", "not", "isinstance", "(", "region", ",", "Region", ")", ":", "raise", "TypeError", "(", "\"morphTo expected a Region object\"", ")", "self", ".", "setROI", "(", "region", ...
Change shape of this region to match the given ``Region`` object
[ "Change", "shape", "of", "this", "region", "to", "match", "the", "given", "Region", "object" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L264-L269
6,719
glitchassassin/lackey
lackey/RegionMatching.py
Region.getCenter
def getCenter(self): """ Return the ``Location`` of the center of this region """ return Location(self.x+(self.w/2), self.y+(self.h/2))
python
def getCenter(self): """ Return the ``Location`` of the center of this region """ return Location(self.x+(self.w/2), self.y+(self.h/2))
[ "def", "getCenter", "(", "self", ")", ":", "return", "Location", "(", "self", ".", "x", "+", "(", "self", ".", "w", "/", "2", ")", ",", "self", ".", "y", "+", "(", "self", ".", "h", "/", "2", ")", ")" ]
Return the ``Location`` of the center of this region
[ "Return", "the", "Location", "of", "the", "center", "of", "this", "region" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L280-L282
6,720
glitchassassin/lackey
lackey/RegionMatching.py
Region.getBottomRight
def getBottomRight(self): """ Return the ``Location`` of the bottom right corner of this region """ return Location(self.x+self.w, self.y+self.h)
python
def getBottomRight(self): """ Return the ``Location`` of the bottom right corner of this region """ return Location(self.x+self.w, self.y+self.h)
[ "def", "getBottomRight", "(", "self", ")", ":", "return", "Location", "(", "self", ".", "x", "+", "self", ".", "w", ",", "self", ".", "y", "+", "self", ".", "h", ")" ]
Return the ``Location`` of the bottom right corner of this region
[ "Return", "the", "Location", "of", "the", "bottom", "right", "corner", "of", "this", "region" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L292-L294
6,721
glitchassassin/lackey
lackey/RegionMatching.py
Region.offset
def offset(self, location, dy=0): """ Returns a new ``Region`` offset from this one by ``location`` Width and height remain the same """ if not isinstance(location, Location): # Assume variables passed were dx,dy location = Location(location, dy) r = Regi...
python
def offset(self, location, dy=0): """ Returns a new ``Region`` offset from this one by ``location`` Width and height remain the same """ if not isinstance(location, Location): # Assume variables passed were dx,dy location = Location(location, dy) r = Regi...
[ "def", "offset", "(", "self", ",", "location", ",", "dy", "=", "0", ")", ":", "if", "not", "isinstance", "(", "location", ",", "Location", ")", ":", "# Assume variables passed were dx,dy", "location", "=", "Location", "(", "location", ",", "dy", ")", "r", ...
Returns a new ``Region`` offset from this one by ``location`` Width and height remain the same
[ "Returns", "a", "new", "Region", "offset", "from", "this", "one", "by", "location" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L331-L343
6,722
glitchassassin/lackey
lackey/RegionMatching.py
Region.grow
def grow(self, width, height=None): """ Expands the region by ``width`` on both sides and ``height`` on the top and bottom. If only one value is provided, expands the region by that amount on all sides. Equivalent to ``nearby()``. """ if height is None: return self.n...
python
def grow(self, width, height=None): """ Expands the region by ``width`` on both sides and ``height`` on the top and bottom. If only one value is provided, expands the region by that amount on all sides. Equivalent to ``nearby()``. """ if height is None: return self.n...
[ "def", "grow", "(", "self", ",", "width", ",", "height", "=", "None", ")", ":", "if", "height", "is", "None", ":", "return", "self", ".", "nearby", "(", "width", ")", "else", ":", "return", "Region", "(", "self", ".", "x", "-", "width", ",", "sel...
Expands the region by ``width`` on both sides and ``height`` on the top and bottom. If only one value is provided, expands the region by that amount on all sides. Equivalent to ``nearby()``.
[ "Expands", "the", "region", "by", "width", "on", "both", "sides", "and", "height", "on", "the", "top", "and", "bottom", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L344-L357
6,723
glitchassassin/lackey
lackey/RegionMatching.py
Region.nearby
def nearby(self, expand=50): """ Returns a new Region that includes the nearby neighbourhood of the the current region. The new region is defined by extending the current region's dimensions all directions by range number of pixels. The center of the new region remains the same. ...
python
def nearby(self, expand=50): """ Returns a new Region that includes the nearby neighbourhood of the the current region. The new region is defined by extending the current region's dimensions all directions by range number of pixels. The center of the new region remains the same. ...
[ "def", "nearby", "(", "self", ",", "expand", "=", "50", ")", ":", "return", "Region", "(", "self", ".", "x", "-", "expand", ",", "self", ".", "y", "-", "expand", ",", "self", ".", "w", "+", "(", "2", "*", "expand", ")", ",", "self", ".", "h",...
Returns a new Region that includes the nearby neighbourhood of the the current region. The new region is defined by extending the current region's dimensions all directions by range number of pixels. The center of the new region remains the same.
[ "Returns", "a", "new", "Region", "that", "includes", "the", "nearby", "neighbourhood", "of", "the", "the", "current", "region", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L361-L372
6,724
glitchassassin/lackey
lackey/RegionMatching.py
Region.left
def left(self, expand=None): """ Returns a new Region left of the current region with a width of ``expand`` pixels. Does not include the current region. If range is omitted, it reaches to the left border of the screen. The new region has the same height and y-position as the current region. ...
python
def left(self, expand=None): """ Returns a new Region left of the current region with a width of ``expand`` pixels. Does not include the current region. If range is omitted, it reaches to the left border of the screen. The new region has the same height and y-position as the current region. ...
[ "def", "left", "(", "self", ",", "expand", "=", "None", ")", ":", "if", "expand", "==", "None", ":", "x", "=", "0", "y", "=", "self", ".", "y", "w", "=", "self", ".", "x", "h", "=", "self", ".", "h", "else", ":", "x", "=", "self", ".", "x...
Returns a new Region left of the current region with a width of ``expand`` pixels. Does not include the current region. If range is omitted, it reaches to the left border of the screen. The new region has the same height and y-position as the current region.
[ "Returns", "a", "new", "Region", "left", "of", "the", "current", "region", "with", "a", "width", "of", "expand", "pixels", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L407-L423
6,725
glitchassassin/lackey
lackey/RegionMatching.py
Region.right
def right(self, expand=None): """ Returns a new Region right of the current region with a width of ``expand`` pixels. Does not include the current region. If range is omitted, it reaches to the right border of the screen. The new region has the same height and y-position as the current region. ...
python
def right(self, expand=None): """ Returns a new Region right of the current region with a width of ``expand`` pixels. Does not include the current region. If range is omitted, it reaches to the right border of the screen. The new region has the same height and y-position as the current region. ...
[ "def", "right", "(", "self", ",", "expand", "=", "None", ")", ":", "if", "expand", "==", "None", ":", "x", "=", "self", ".", "x", "+", "self", ".", "w", "y", "=", "self", ".", "y", "w", "=", "self", ".", "getScreen", "(", ")", ".", "getBounds...
Returns a new Region right of the current region with a width of ``expand`` pixels. Does not include the current region. If range is omitted, it reaches to the right border of the screen. The new region has the same height and y-position as the current region.
[ "Returns", "a", "new", "Region", "right", "of", "the", "current", "region", "with", "a", "width", "of", "expand", "pixels", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L424-L440
6,726
glitchassassin/lackey
lackey/RegionMatching.py
Region.getBitmap
def getBitmap(self): """ Captures screen area of this region, at least the part that is on the screen Returns image as numpy array """ return PlatformManager.getBitmapFromRect(self.x, self.y, self.w, self.h)
python
def getBitmap(self): """ Captures screen area of this region, at least the part that is on the screen Returns image as numpy array """ return PlatformManager.getBitmapFromRect(self.x, self.y, self.w, self.h)
[ "def", "getBitmap", "(", "self", ")", ":", "return", "PlatformManager", ".", "getBitmapFromRect", "(", "self", ".", "x", ",", "self", ".", "y", ",", "self", ".", "w", ",", "self", ".", "h", ")" ]
Captures screen area of this region, at least the part that is on the screen Returns image as numpy array
[ "Captures", "screen", "area", "of", "this", "region", "at", "least", "the", "part", "that", "is", "on", "the", "screen" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L449-L454
6,727
glitchassassin/lackey
lackey/RegionMatching.py
Region.debugPreview
def debugPreview(self, title="Debug"): """ Displays the region in a preview window. If the region is a Match, circles the target area. If the region is larger than half the primary screen in either dimension, scales it down to half size. """ region = self haystack = self...
python
def debugPreview(self, title="Debug"): """ Displays the region in a preview window. If the region is a Match, circles the target area. If the region is larger than half the primary screen in either dimension, scales it down to half size. """ region = self haystack = self...
[ "def", "debugPreview", "(", "self", ",", "title", "=", "\"Debug\"", ")", ":", "region", "=", "self", "haystack", "=", "self", ".", "getBitmap", "(", ")", "if", "isinstance", "(", "region", ",", "Match", ")", ":", "cv2", ".", "circle", "(", "haystack", ...
Displays the region in a preview window. If the region is a Match, circles the target area. If the region is larger than half the primary screen in either dimension, scales it down to half size.
[ "Displays", "the", "region", "in", "a", "preview", "window", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L455-L472
6,728
glitchassassin/lackey
lackey/RegionMatching.py
Region.wait
def wait(self, pattern, seconds=None): """ Searches for an image pattern in the given region, given a specified timeout period Functionally identical to find(). If a number is passed instead of a pattern, just waits the specified number of seconds. Sikuli supports OCR search with a text...
python
def wait(self, pattern, seconds=None): """ Searches for an image pattern in the given region, given a specified timeout period Functionally identical to find(). If a number is passed instead of a pattern, just waits the specified number of seconds. Sikuli supports OCR search with a text...
[ "def", "wait", "(", "self", ",", "pattern", ",", "seconds", "=", "None", ")", ":", "if", "isinstance", "(", "pattern", ",", "(", "int", ",", "float", ")", ")", ":", "if", "pattern", "==", "FOREVER", ":", "while", "True", ":", "time", ".", "sleep", ...
Searches for an image pattern in the given region, given a specified timeout period Functionally identical to find(). If a number is passed instead of a pattern, just waits the specified number of seconds. Sikuli supports OCR search with a text parameter. This does not (yet).
[ "Searches", "for", "an", "image", "pattern", "in", "the", "given", "region", "given", "a", "specified", "timeout", "period" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L566-L596
6,729
glitchassassin/lackey
lackey/RegionMatching.py
Region.waitVanish
def waitVanish(self, pattern, seconds=None): """ Waits until the specified pattern is not visible on screen. If ``seconds`` pass and the pattern is still visible, raises FindFailed exception. Sikuli supports OCR search with a text parameter. This does not (yet). """ r = self.cli...
python
def waitVanish(self, pattern, seconds=None): """ Waits until the specified pattern is not visible on screen. If ``seconds`` pass and the pattern is still visible, raises FindFailed exception. Sikuli supports OCR search with a text parameter. This does not (yet). """ r = self.cli...
[ "def", "waitVanish", "(", "self", ",", "pattern", ",", "seconds", "=", "None", ")", ":", "r", "=", "self", ".", "clipRegionToScreen", "(", ")", "if", "r", "is", "None", ":", "raise", "ValueError", "(", "\"Region outside all visible screens\"", ")", "return",...
Waits until the specified pattern is not visible on screen. If ``seconds`` pass and the pattern is still visible, raises FindFailed exception. Sikuli supports OCR search with a text parameter. This does not (yet).
[ "Waits", "until", "the", "specified", "pattern", "is", "not", "visible", "on", "screen", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L597-L624
6,730
glitchassassin/lackey
lackey/RegionMatching.py
Region.click
def click(self, target=None, modifiers=""): """ Moves the cursor to the target location and clicks the default mouse button. """ if target is None: target = self._lastMatch or self # Whichever one is not None target_location = None if isinstance(target, Pattern): ...
python
def click(self, target=None, modifiers=""): """ Moves the cursor to the target location and clicks the default mouse button. """ if target is None: target = self._lastMatch or self # Whichever one is not None target_location = None if isinstance(target, Pattern): ...
[ "def", "click", "(", "self", ",", "target", "=", "None", ",", "modifiers", "=", "\"\"", ")", ":", "if", "target", "is", "None", ":", "target", "=", "self", ".", "_lastMatch", "or", "self", "# Whichever one is not None", "target_location", "=", "None", "if"...
Moves the cursor to the target location and clicks the default mouse button.
[ "Moves", "the", "cursor", "to", "the", "target", "location", "and", "clicks", "the", "default", "mouse", "button", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L686-L717
6,731
glitchassassin/lackey
lackey/RegionMatching.py
Region.hover
def hover(self, target=None): """ Moves the cursor to the target location """ if target is None: target = self._lastMatch or self # Whichever one is not None target_location = None if isinstance(target, Pattern): target_location = self.find(target).getTarget() ...
python
def hover(self, target=None): """ Moves the cursor to the target location """ if target is None: target = self._lastMatch or self # Whichever one is not None target_location = None if isinstance(target, Pattern): target_location = self.find(target).getTarget() ...
[ "def", "hover", "(", "self", ",", "target", "=", "None", ")", ":", "if", "target", "is", "None", ":", "target", "=", "self", ".", "_lastMatch", "or", "self", "# Whichever one is not None", "target_location", "=", "None", "if", "isinstance", "(", "target", ...
Moves the cursor to the target location
[ "Moves", "the", "cursor", "to", "the", "target", "location" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L785-L803
6,732
glitchassassin/lackey
lackey/RegionMatching.py
Region.drag
def drag(self, dragFrom=None): """ Starts a dragDrop operation. Moves the cursor to the target location and clicks the mouse in preparation to drag a screen element """ if dragFrom is None: dragFrom = self._lastMatch or self # Whichever one is not None dragFromLocati...
python
def drag(self, dragFrom=None): """ Starts a dragDrop operation. Moves the cursor to the target location and clicks the mouse in preparation to drag a screen element """ if dragFrom is None: dragFrom = self._lastMatch or self # Whichever one is not None dragFromLocati...
[ "def", "drag", "(", "self", ",", "dragFrom", "=", "None", ")", ":", "if", "dragFrom", "is", "None", ":", "dragFrom", "=", "self", ".", "_lastMatch", "or", "self", "# Whichever one is not None", "dragFromLocation", "=", "None", "if", "isinstance", "(", "dragF...
Starts a dragDrop operation. Moves the cursor to the target location and clicks the mouse in preparation to drag a screen element
[ "Starts", "a", "dragDrop", "operation", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L804-L827
6,733
glitchassassin/lackey
lackey/RegionMatching.py
Region.dropAt
def dropAt(self, dragTo=None, delay=None): """ Completes a dragDrop operation Moves the cursor to the target location, waits ``delay`` seconds, and releases the mouse button """ if dragTo is None: dragTo = self._lastMatch or self # Whichever one is not None if isinst...
python
def dropAt(self, dragTo=None, delay=None): """ Completes a dragDrop operation Moves the cursor to the target location, waits ``delay`` seconds, and releases the mouse button """ if dragTo is None: dragTo = self._lastMatch or self # Whichever one is not None if isinst...
[ "def", "dropAt", "(", "self", ",", "dragTo", "=", "None", ",", "delay", "=", "None", ")", ":", "if", "dragTo", "is", "None", ":", "dragTo", "=", "self", ".", "_lastMatch", "or", "self", "# Whichever one is not None", "if", "isinstance", "(", "dragTo", ",...
Completes a dragDrop operation Moves the cursor to the target location, waits ``delay`` seconds, and releases the mouse button
[ "Completes", "a", "dragDrop", "operation" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L828-L851
6,734
glitchassassin/lackey
lackey/RegionMatching.py
Region.dragDrop
def dragDrop(self, target, target2=None, modifiers=""): """ Performs a dragDrop operation. Holds down the mouse button on ``dragFrom``, moves the mouse to ``dragTo``, and releases the mouse button. ``modifiers`` may be a typeKeys() compatible string. The specified keys will be held ...
python
def dragDrop(self, target, target2=None, modifiers=""): """ Performs a dragDrop operation. Holds down the mouse button on ``dragFrom``, moves the mouse to ``dragTo``, and releases the mouse button. ``modifiers`` may be a typeKeys() compatible string. The specified keys will be held ...
[ "def", "dragDrop", "(", "self", ",", "target", ",", "target2", "=", "None", ",", "modifiers", "=", "\"\"", ")", ":", "if", "modifiers", "!=", "\"\"", ":", "keyboard", ".", "keyDown", "(", "modifiers", ")", "if", "target2", "is", "None", ":", "dragFrom"...
Performs a dragDrop operation. Holds down the mouse button on ``dragFrom``, moves the mouse to ``dragTo``, and releases the mouse button. ``modifiers`` may be a typeKeys() compatible string. The specified keys will be held during the drag-drop operation.
[ "Performs", "a", "dragDrop", "operation", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L852-L876
6,735
glitchassassin/lackey
lackey/RegionMatching.py
Region.mouseMove
def mouseMove(self, PSRML=None, dy=0): """ Low-level mouse actions """ if PSRML is None: PSRML = self._lastMatch or self # Whichever one is not None if isinstance(PSRML, Pattern): move_location = self.find(PSRML).getTarget() elif isinstance(PSRML, basestring): ...
python
def mouseMove(self, PSRML=None, dy=0): """ Low-level mouse actions """ if PSRML is None: PSRML = self._lastMatch or self # Whichever one is not None if isinstance(PSRML, Pattern): move_location = self.find(PSRML).getTarget() elif isinstance(PSRML, basestring): ...
[ "def", "mouseMove", "(", "self", ",", "PSRML", "=", "None", ",", "dy", "=", "0", ")", ":", "if", "PSRML", "is", "None", ":", "PSRML", "=", "self", ".", "_lastMatch", "or", "self", "# Whichever one is not None", "if", "isinstance", "(", "PSRML", ",", "P...
Low-level mouse actions
[ "Low", "-", "level", "mouse", "actions" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L959-L979
6,736
glitchassassin/lackey
lackey/RegionMatching.py
Region.isRegionValid
def isRegionValid(self): """ Returns false if the whole region is not even partially inside any screen, otherwise true """ screens = PlatformManager.getScreenDetails() for screen in screens: s_x, s_y, s_w, s_h = screen["rect"] if self.x+self.w >= s_x and s_x+s_w >= self.x...
python
def isRegionValid(self): """ Returns false if the whole region is not even partially inside any screen, otherwise true """ screens = PlatformManager.getScreenDetails() for screen in screens: s_x, s_y, s_w, s_h = screen["rect"] if self.x+self.w >= s_x and s_x+s_w >= self.x...
[ "def", "isRegionValid", "(", "self", ")", ":", "screens", "=", "PlatformManager", ".", "getScreenDetails", "(", ")", "for", "screen", "in", "screens", ":", "s_x", ",", "s_y", ",", "s_w", ",", "s_h", "=", "screen", "[", "\"rect\"", "]", "if", "self", "....
Returns false if the whole region is not even partially inside any screen, otherwise true
[ "Returns", "false", "if", "the", "whole", "region", "is", "not", "even", "partially", "inside", "any", "screen", "otherwise", "true" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1017-L1025
6,737
glitchassassin/lackey
lackey/RegionMatching.py
Region.clipRegionToScreen
def clipRegionToScreen(self): """ Returns the part of the region that is visible on a screen If the region equals to all visible screens, returns Screen(-1). If the region is visible on multiple screens, returns the screen with the smallest ID. Returns None if the region is outside the ...
python
def clipRegionToScreen(self): """ Returns the part of the region that is visible on a screen If the region equals to all visible screens, returns Screen(-1). If the region is visible on multiple screens, returns the screen with the smallest ID. Returns None if the region is outside the ...
[ "def", "clipRegionToScreen", "(", "self", ")", ":", "if", "not", "self", ".", "isRegionValid", "(", ")", ":", "return", "None", "screens", "=", "PlatformManager", ".", "getScreenDetails", "(", ")", "total_x", ",", "total_y", ",", "total_w", ",", "total_h", ...
Returns the part of the region that is visible on a screen If the region equals to all visible screens, returns Screen(-1). If the region is visible on multiple screens, returns the screen with the smallest ID. Returns None if the region is outside the screen.
[ "Returns", "the", "part", "of", "the", "region", "that", "is", "visible", "on", "a", "screen" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1027-L1057
6,738
glitchassassin/lackey
lackey/RegionMatching.py
Region.get
def get(self, part): """ Returns a section of the region as a new region Accepts partitioning constants, e.g. Region.NORTH, Region.NORTH_WEST, etc. Also accepts an int 200-999: * First digit: Raster (*n* rows by *n* columns) * Second digit: Row index (if equal to raster, gets t...
python
def get(self, part): """ Returns a section of the region as a new region Accepts partitioning constants, e.g. Region.NORTH, Region.NORTH_WEST, etc. Also accepts an int 200-999: * First digit: Raster (*n* rows by *n* columns) * Second digit: Row index (if equal to raster, gets t...
[ "def", "get", "(", "self", ",", "part", ")", ":", "if", "part", "==", "self", ".", "MID_VERTICAL", ":", "return", "Region", "(", "self", ".", "x", "+", "(", "self", ".", "w", "/", "4", ")", ",", "y", ",", "self", ".", "w", "/", "2", ",", "s...
Returns a section of the region as a new region Accepts partitioning constants, e.g. Region.NORTH, Region.NORTH_WEST, etc. Also accepts an int 200-999: * First digit: Raster (*n* rows by *n* columns) * Second digit: Row index (if equal to raster, gets the whole row) * Third dig...
[ "Returns", "a", "section", "of", "the", "region", "as", "a", "new", "region" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1160-L1192
6,739
glitchassassin/lackey
lackey/RegionMatching.py
Region.setCenter
def setCenter(self, loc): """ Move this region so it is centered on ``loc`` """ offset = self.getCenter().getOffset(loc) # Calculate offset from current center return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
python
def setCenter(self, loc): """ Move this region so it is centered on ``loc`` """ offset = self.getCenter().getOffset(loc) # Calculate offset from current center return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
[ "def", "setCenter", "(", "self", ",", "loc", ")", ":", "offset", "=", "self", ".", "getCenter", "(", ")", ".", "getOffset", "(", "loc", ")", "# Calculate offset from current center", "return", "self", ".", "setLocation", "(", "self", ".", "getTopLeft", "(", ...
Move this region so it is centered on ``loc``
[ "Move", "this", "region", "so", "it", "is", "centered", "on", "loc" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1226-L1229
6,740
glitchassassin/lackey
lackey/RegionMatching.py
Region.setTopRight
def setTopRight(self, loc): """ Move this region so its top right corner is on ``loc`` """ offset = self.getTopRight().getOffset(loc) # Calculate offset from current top right return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
python
def setTopRight(self, loc): """ Move this region so its top right corner is on ``loc`` """ offset = self.getTopRight().getOffset(loc) # Calculate offset from current top right return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
[ "def", "setTopRight", "(", "self", ",", "loc", ")", ":", "offset", "=", "self", ".", "getTopRight", "(", ")", ".", "getOffset", "(", "loc", ")", "# Calculate offset from current top right", "return", "self", ".", "setLocation", "(", "self", ".", "getTopLeft", ...
Move this region so its top right corner is on ``loc``
[ "Move", "this", "region", "so", "its", "top", "right", "corner", "is", "on", "loc" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1233-L1236
6,741
glitchassassin/lackey
lackey/RegionMatching.py
Region.setBottomLeft
def setBottomLeft(self, loc): """ Move this region so its bottom left corner is on ``loc`` """ offset = self.getBottomLeft().getOffset(loc) # Calculate offset from current bottom left return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
python
def setBottomLeft(self, loc): """ Move this region so its bottom left corner is on ``loc`` """ offset = self.getBottomLeft().getOffset(loc) # Calculate offset from current bottom left return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
[ "def", "setBottomLeft", "(", "self", ",", "loc", ")", ":", "offset", "=", "self", ".", "getBottomLeft", "(", ")", ".", "getOffset", "(", "loc", ")", "# Calculate offset from current bottom left", "return", "self", ".", "setLocation", "(", "self", ".", "getTopL...
Move this region so its bottom left corner is on ``loc``
[ "Move", "this", "region", "so", "its", "bottom", "left", "corner", "is", "on", "loc" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1237-L1240
6,742
glitchassassin/lackey
lackey/RegionMatching.py
Region.setBottomRight
def setBottomRight(self, loc): """ Move this region so its bottom right corner is on ``loc`` """ offset = self.getBottomRight().getOffset(loc) # Calculate offset from current bottom right return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
python
def setBottomRight(self, loc): """ Move this region so its bottom right corner is on ``loc`` """ offset = self.getBottomRight().getOffset(loc) # Calculate offset from current bottom right return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
[ "def", "setBottomRight", "(", "self", ",", "loc", ")", ":", "offset", "=", "self", ".", "getBottomRight", "(", ")", ".", "getOffset", "(", "loc", ")", "# Calculate offset from current bottom right", "return", "self", ".", "setLocation", "(", "self", ".", "getT...
Move this region so its bottom right corner is on ``loc``
[ "Move", "this", "region", "so", "its", "bottom", "right", "corner", "is", "on", "loc" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1241-L1244
6,743
glitchassassin/lackey
lackey/RegionMatching.py
Region.setSize
def setSize(self, w, h): """ Sets the new size of the region """ self.setW(w) self.setH(h) return self
python
def setSize(self, w, h): """ Sets the new size of the region """ self.setW(w) self.setH(h) return self
[ "def", "setSize", "(", "self", ",", "w", ",", "h", ")", ":", "self", ".", "setW", "(", "w", ")", "self", ".", "setH", "(", "h", ")", "return", "self" ]
Sets the new size of the region
[ "Sets", "the", "new", "size", "of", "the", "region" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1245-L1249
6,744
glitchassassin/lackey
lackey/RegionMatching.py
Region.saveScreenCapture
def saveScreenCapture(self, path=None, name=None): """ Saves the region's bitmap """ bitmap = self.getBitmap() target_file = None if path is None and name is None: _, target_file = tempfile.mkstemp(".png") elif name is None: _, tpath = tempfile.mkstemp(".p...
python
def saveScreenCapture(self, path=None, name=None): """ Saves the region's bitmap """ bitmap = self.getBitmap() target_file = None if path is None and name is None: _, target_file = tempfile.mkstemp(".png") elif name is None: _, tpath = tempfile.mkstemp(".p...
[ "def", "saveScreenCapture", "(", "self", ",", "path", "=", "None", ",", "name", "=", "None", ")", ":", "bitmap", "=", "self", ".", "getBitmap", "(", ")", "target_file", "=", "None", "if", "path", "is", "None", "and", "name", "is", "None", ":", "_", ...
Saves the region's bitmap
[ "Saves", "the", "region", "s", "bitmap" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1277-L1289
6,745
glitchassassin/lackey
lackey/RegionMatching.py
Region.saveLastScreenImage
def saveLastScreenImage(self): """ Saves the last image taken on this region's screen to a temporary file """ bitmap = self.getLastScreenImage() _, target_file = tempfile.mkstemp(".png") cv2.imwrite(target_file, bitmap)
python
def saveLastScreenImage(self): """ Saves the last image taken on this region's screen to a temporary file """ bitmap = self.getLastScreenImage() _, target_file = tempfile.mkstemp(".png") cv2.imwrite(target_file, bitmap)
[ "def", "saveLastScreenImage", "(", "self", ")", ":", "bitmap", "=", "self", ".", "getLastScreenImage", "(", ")", "_", ",", "target_file", "=", "tempfile", ".", "mkstemp", "(", "\".png\"", ")", "cv2", ".", "imwrite", "(", "target_file", ",", "bitmap", ")" ]
Saves the last image taken on this region's screen to a temporary file
[ "Saves", "the", "last", "image", "taken", "on", "this", "region", "s", "screen", "to", "a", "temporary", "file" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1293-L1297
6,746
glitchassassin/lackey
lackey/RegionMatching.py
Region.onChange
def onChange(self, min_changed_pixels=None, handler=None): """ Registers an event to call ``handler`` when at least ``min_changed_pixels`` change in this region. (Default for min_changed_pixels is set in Settings.ObserveMinChangedPixels) The ``handler`` function should take one paramet...
python
def onChange(self, min_changed_pixels=None, handler=None): """ Registers an event to call ``handler`` when at least ``min_changed_pixels`` change in this region. (Default for min_changed_pixels is set in Settings.ObserveMinChangedPixels) The ``handler`` function should take one paramet...
[ "def", "onChange", "(", "self", ",", "min_changed_pixels", "=", "None", ",", "handler", "=", "None", ")", ":", "if", "isinstance", "(", "min_changed_pixels", ",", "int", ")", "and", "(", "callable", "(", "handler", ")", "or", "handler", "is", "None", ")"...
Registers an event to call ``handler`` when at least ``min_changed_pixels`` change in this region. (Default for min_changed_pixels is set in Settings.ObserveMinChangedPixels) The ``handler`` function should take one parameter, an ObserveEvent object (see below). This event is ignored i...
[ "Registers", "an", "event", "to", "call", "handler", "when", "at", "least", "min_changed_pixels", "change", "in", "this", "region", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1400-L1424
6,747
glitchassassin/lackey
lackey/RegionMatching.py
Region.isChanged
def isChanged(self, min_changed_pixels, screen_state): """ Returns true if at least ``min_changed_pixels`` are different between ``screen_state`` and the current state. """ r = self.clipRegionToScreen() current_state = r.getBitmap() diff = numpy.subtract(current_state, sc...
python
def isChanged(self, min_changed_pixels, screen_state): """ Returns true if at least ``min_changed_pixels`` are different between ``screen_state`` and the current state. """ r = self.clipRegionToScreen() current_state = r.getBitmap() diff = numpy.subtract(current_state, sc...
[ "def", "isChanged", "(", "self", ",", "min_changed_pixels", ",", "screen_state", ")", ":", "r", "=", "self", ".", "clipRegionToScreen", "(", ")", "current_state", "=", "r", ".", "getBitmap", "(", ")", "diff", "=", "numpy", ".", "subtract", "(", "current_st...
Returns true if at least ``min_changed_pixels`` are different between ``screen_state`` and the current state.
[ "Returns", "true", "if", "at", "least", "min_changed_pixels", "are", "different", "between", "screen_state", "and", "the", "current", "state", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1425-L1432
6,748
glitchassassin/lackey
lackey/RegionMatching.py
Region.stopObserver
def stopObserver(self): """ Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically. """ self._observer.isStopped = True self._observer.isRunning = False
python
def stopObserver(self): """ Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically. """ self._observer.isStopped = True self._observer.isRunning = False
[ "def", "stopObserver", "(", "self", ")", ":", "self", ".", "_observer", ".", "isStopped", "=", "True", "self", ".", "_observer", ".", "isRunning", "=", "False" ]
Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically.
[ "Stops", "this", "region", "s", "observer", "loop", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1486-L1492
6,749
glitchassassin/lackey
lackey/RegionMatching.py
Region.getEvents
def getEvents(self): """ Returns a list of all events that have occurred. Empties the internal queue. """ caught_events = self._observer.caught_events self._observer.caught_events = [] for event in caught_events: self._observer.activate_event(event["name"]) ...
python
def getEvents(self): """ Returns a list of all events that have occurred. Empties the internal queue. """ caught_events = self._observer.caught_events self._observer.caught_events = [] for event in caught_events: self._observer.activate_event(event["name"]) ...
[ "def", "getEvents", "(", "self", ")", ":", "caught_events", "=", "self", ".", "_observer", ".", "caught_events", "self", ".", "_observer", ".", "caught_events", "=", "[", "]", "for", "event", "in", "caught_events", ":", "self", ".", "_observer", ".", "acti...
Returns a list of all events that have occurred. Empties the internal queue.
[ "Returns", "a", "list", "of", "all", "events", "that", "have", "occurred", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1506-L1515
6,750
glitchassassin/lackey
lackey/RegionMatching.py
Region.getEvent
def getEvent(self, name): """ Returns the named event. Removes it from the internal queue. """ to_return = None for event in self._observer.caught_events: if event["name"] == name: to_return = event break if to_return: ...
python
def getEvent(self, name): """ Returns the named event. Removes it from the internal queue. """ to_return = None for event in self._observer.caught_events: if event["name"] == name: to_return = event break if to_return: ...
[ "def", "getEvent", "(", "self", ",", "name", ")", ":", "to_return", "=", "None", "for", "event", "in", "self", ".", "_observer", ".", "caught_events", ":", "if", "event", "[", "\"name\"", "]", "==", "name", ":", "to_return", "=", "event", "break", "if"...
Returns the named event. Removes it from the internal queue.
[ "Returns", "the", "named", "event", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1516-L1529
6,751
glitchassassin/lackey
lackey/RegionMatching.py
Region.setFindFailedResponse
def setFindFailedResponse(self, response): """ Set the response to a FindFailed exception in this region. Can be ABORT, SKIP, PROMPT, or RETRY. """ valid_responses = ("ABORT", "SKIP", "PROMPT", "RETRY") if response not in valid_responses: raise ValueError("Invalid re...
python
def setFindFailedResponse(self, response): """ Set the response to a FindFailed exception in this region. Can be ABORT, SKIP, PROMPT, or RETRY. """ valid_responses = ("ABORT", "SKIP", "PROMPT", "RETRY") if response not in valid_responses: raise ValueError("Invalid re...
[ "def", "setFindFailedResponse", "(", "self", ",", "response", ")", ":", "valid_responses", "=", "(", "\"ABORT\"", ",", "\"SKIP\"", ",", "\"PROMPT\"", ",", "\"RETRY\"", ")", "if", "response", "not", "in", "valid_responses", ":", "raise", "ValueError", "(", "\"I...
Set the response to a FindFailed exception in this region. Can be ABORT, SKIP, PROMPT, or RETRY.
[ "Set", "the", "response", "to", "a", "FindFailed", "exception", "in", "this", "region", ".", "Can", "be", "ABORT", "SKIP", "PROMPT", "or", "RETRY", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1569-L1576
6,752
glitchassassin/lackey
lackey/RegionMatching.py
Region.setThrowException
def setThrowException(self, setting): """ Defines whether an exception should be thrown for FindFailed operations. ``setting`` should be True or False. """ if setting: self._throwException = True self._findFailedResponse = "ABORT" else: self._throwExc...
python
def setThrowException(self, setting): """ Defines whether an exception should be thrown for FindFailed operations. ``setting`` should be True or False. """ if setting: self._throwException = True self._findFailedResponse = "ABORT" else: self._throwExc...
[ "def", "setThrowException", "(", "self", ",", "setting", ")", ":", "if", "setting", ":", "self", ".", "_throwException", "=", "True", "self", ".", "_findFailedResponse", "=", "\"ABORT\"", "else", ":", "self", ".", "_throwException", "=", "False", "self", "."...
Defines whether an exception should be thrown for FindFailed operations. ``setting`` should be True or False.
[ "Defines", "whether", "an", "exception", "should", "be", "thrown", "for", "FindFailed", "operations", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1586-L1595
6,753
glitchassassin/lackey
lackey/RegionMatching.py
Observer.register_event
def register_event(self, event_type, pattern, handler): """ When ``event_type`` is observed for ``pattern``, triggers ``handler``. For "CHANGE" events, ``pattern`` should be a tuple of ``min_changed_pixels`` and the base screen state. """ if event_type not in self._supported_eve...
python
def register_event(self, event_type, pattern, handler): """ When ``event_type`` is observed for ``pattern``, triggers ``handler``. For "CHANGE" events, ``pattern`` should be a tuple of ``min_changed_pixels`` and the base screen state. """ if event_type not in self._supported_eve...
[ "def", "register_event", "(", "self", ",", "event_type", ",", "pattern", ",", "handler", ")", ":", "if", "event_type", "not", "in", "self", ".", "_supported_events", ":", "raise", "ValueError", "(", "\"Unsupported event type {}\"", ".", "format", "(", "event_typ...
When ``event_type`` is observed for ``pattern``, triggers ``handler``. For "CHANGE" events, ``pattern`` should be a tuple of ``min_changed_pixels`` and the base screen state.
[ "When", "event_type", "is", "observed", "for", "pattern", "triggers", "handler", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1650-L1673
6,754
glitchassassin/lackey
lackey/RegionMatching.py
Screen.capture
def capture(self, *args): #x=None, y=None, w=None, h=None): """ Captures the region as an image """ if len(args) == 0: # Capture screen region region = self elif isinstance(args[0], Region): # Capture specified region region = args[0] elif ...
python
def capture(self, *args): #x=None, y=None, w=None, h=None): """ Captures the region as an image """ if len(args) == 0: # Capture screen region region = self elif isinstance(args[0], Region): # Capture specified region region = args[0] elif ...
[ "def", "capture", "(", "self", ",", "*", "args", ")", ":", "#x=None, y=None, w=None, h=None):", "if", "len", "(", "args", ")", "==", "0", ":", "# Capture screen region", "region", "=", "self", "elif", "isinstance", "(", "args", "[", "0", "]", ",", "Region"...
Captures the region as an image
[ "Captures", "the", "region", "as", "an", "image" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1854-L1872
6,755
glitchassassin/lackey
lackey/RegionMatching.py
Screen.showMonitors
def showMonitors(cls): """ Prints debug information about currently detected screens """ Debug.info("*** monitor configuration [ {} Screen(s)] ***".format(cls.getNumberScreens())) Debug.info("*** Primary is Screen {}".format(cls.primaryScreen)) for index, screen in enumerate(PlatformMana...
python
def showMonitors(cls): """ Prints debug information about currently detected screens """ Debug.info("*** monitor configuration [ {} Screen(s)] ***".format(cls.getNumberScreens())) Debug.info("*** Primary is Screen {}".format(cls.primaryScreen)) for index, screen in enumerate(PlatformMana...
[ "def", "showMonitors", "(", "cls", ")", ":", "Debug", ".", "info", "(", "\"*** monitor configuration [ {} Screen(s)] ***\"", ".", "format", "(", "cls", ".", "getNumberScreens", "(", ")", ")", ")", "Debug", ".", "info", "(", "\"*** Primary is Screen {}\"", ".", "...
Prints debug information about currently detected screens
[ "Prints", "debug", "information", "about", "currently", "detected", "screens" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1908-L1914
6,756
glitchassassin/lackey
lackey/RegionMatching.py
Screen.resetMonitors
def resetMonitors(self): """ Recalculates screen based on changed monitor setup """ Debug.error("*** BE AWARE: experimental - might not work ***") Debug.error("Re-evaluation of the monitor setup has been requested") Debug.error("... Current Region/Screen objects might not be valid any lo...
python
def resetMonitors(self): """ Recalculates screen based on changed monitor setup """ Debug.error("*** BE AWARE: experimental - might not work ***") Debug.error("Re-evaluation of the monitor setup has been requested") Debug.error("... Current Region/Screen objects might not be valid any lo...
[ "def", "resetMonitors", "(", "self", ")", ":", "Debug", ".", "error", "(", "\"*** BE AWARE: experimental - might not work ***\"", ")", "Debug", ".", "error", "(", "\"Re-evaluation of the monitor setup has been requested\"", ")", "Debug", ".", "error", "(", "\"... Current ...
Recalculates screen based on changed monitor setup
[ "Recalculates", "screen", "based", "on", "changed", "monitor", "setup" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1915-L1922
6,757
glitchassassin/lackey
lackey/RegionMatching.py
Screen.newRegion
def newRegion(self, loc, width, height): """ Creates a new region on the current screen at the specified offset with the specified width and height. """ return Region.create(self.getTopLeft().offset(loc), width, height)
python
def newRegion(self, loc, width, height): """ Creates a new region on the current screen at the specified offset with the specified width and height. """ return Region.create(self.getTopLeft().offset(loc), width, height)
[ "def", "newRegion", "(", "self", ",", "loc", ",", "width", ",", "height", ")", ":", "return", "Region", ".", "create", "(", "self", ".", "getTopLeft", "(", ")", ".", "offset", "(", "loc", ")", ",", "width", ",", "height", ")" ]
Creates a new region on the current screen at the specified offset with the specified width and height.
[ "Creates", "a", "new", "region", "on", "the", "current", "screen", "at", "the", "specified", "offset", "with", "the", "specified", "width", "and", "height", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1923-L1926
6,758
glitchassassin/lackey
lackey/SettingsDebug.py
DebugMaster.history
def history(self, message): """ Records an Action-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT """ if Settings.ActionLogs: self._write_log("action", Settings.LogTime, message)
python
def history(self, message): """ Records an Action-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT """ if Settings.ActionLogs: self._write_log("action", Settings.LogTime, message)
[ "def", "history", "(", "self", ",", "message", ")", ":", "if", "Settings", ".", "ActionLogs", ":", "self", ".", "_write_log", "(", "\"action\"", ",", "Settings", ".", "LogTime", ",", "message", ")" ]
Records an Action-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT
[ "Records", "an", "Action", "-", "level", "log", "message" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/SettingsDebug.py#L34-L41
6,759
glitchassassin/lackey
lackey/SettingsDebug.py
DebugMaster.error
def error(self, message): """ Records an Error-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT """ if Settings.ErrorLogs: self._write_log("error", Settings.LogTime, message)
python
def error(self, message): """ Records an Error-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT """ if Settings.ErrorLogs: self._write_log("error", Settings.LogTime, message)
[ "def", "error", "(", "self", ",", "message", ")", ":", "if", "Settings", ".", "ErrorLogs", ":", "self", ".", "_write_log", "(", "\"error\"", ",", "Settings", ".", "LogTime", ",", "message", ")" ]
Records an Error-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT
[ "Records", "an", "Error", "-", "level", "log", "message" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/SettingsDebug.py#L42-L49
6,760
glitchassassin/lackey
lackey/SettingsDebug.py
DebugMaster.info
def info(self, message): """ Records an Info-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT """ if Settings.InfoLogs: self._write_log("info", Settings.LogTime, message)
python
def info(self, message): """ Records an Info-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT """ if Settings.InfoLogs: self._write_log("info", Settings.LogTime, message)
[ "def", "info", "(", "self", ",", "message", ")", ":", "if", "Settings", ".", "InfoLogs", ":", "self", ".", "_write_log", "(", "\"info\"", ",", "Settings", ".", "LogTime", ",", "message", ")" ]
Records an Info-level log message Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT
[ "Records", "an", "Info", "-", "level", "log", "message" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/SettingsDebug.py#L50-L57
6,761
glitchassassin/lackey
lackey/SettingsDebug.py
DebugMaster.on
def on(self, level): """ Turns on all debugging messages up to the specified level 0 = None; 1 = User; """ if isinstance(level, int) and level >= 0 and level <= 3: self._debug_level = level
python
def on(self, level): """ Turns on all debugging messages up to the specified level 0 = None; 1 = User; """ if isinstance(level, int) and level >= 0 and level <= 3: self._debug_level = level
[ "def", "on", "(", "self", ",", "level", ")", ":", "if", "isinstance", "(", "level", ",", "int", ")", "and", "level", ">=", "0", "and", "level", "<=", "3", ":", "self", ".", "_debug_level", "=", "level" ]
Turns on all debugging messages up to the specified level 0 = None; 1 = User;
[ "Turns", "on", "all", "debugging", "messages", "up", "to", "the", "specified", "level" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/SettingsDebug.py#L58-L64
6,762
glitchassassin/lackey
lackey/SettingsDebug.py
DebugMaster.setLogFile
def setLogFile(self, filepath): """ Defines the file to which output log messages should be sent. Set to `None` to print to STDOUT instead. """ if filepath is None: self._log_file = None return parsed_path = os.path.abspath(filepath) # Checks if t...
python
def setLogFile(self, filepath): """ Defines the file to which output log messages should be sent. Set to `None` to print to STDOUT instead. """ if filepath is None: self._log_file = None return parsed_path = os.path.abspath(filepath) # Checks if t...
[ "def", "setLogFile", "(", "self", ",", "filepath", ")", ":", "if", "filepath", "is", "None", ":", "self", ".", "_log_file", "=", "None", "return", "parsed_path", "=", "os", ".", "path", ".", "abspath", "(", "filepath", ")", "# Checks if the provided log file...
Defines the file to which output log messages should be sent. Set to `None` to print to STDOUT instead.
[ "Defines", "the", "file", "to", "which", "output", "log", "messages", "should", "be", "sent", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/SettingsDebug.py#L102-L116
6,763
glitchassassin/lackey
lackey/SettingsDebug.py
DebugMaster._write_log
def _write_log(self, log_type, log_time, message): """ Private method to abstract log writing for different types of logs """ timestamp = datetime.datetime.now().strftime(" %Y-%m-%d %H:%M:%S") log_entry = "[{}{}] {}".format(log_type, timestamp if log_time else "", message) if self._logge...
python
def _write_log(self, log_type, log_time, message): """ Private method to abstract log writing for different types of logs """ timestamp = datetime.datetime.now().strftime(" %Y-%m-%d %H:%M:%S") log_entry = "[{}{}] {}".format(log_type, timestamp if log_time else "", message) if self._logge...
[ "def", "_write_log", "(", "self", ",", "log_type", ",", "log_time", ",", "message", ")", ":", "timestamp", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\" %Y-%m-%d %H:%M:%S\"", ")", "log_entry", "=", "\"[{}{}] {}\"", ".", ...
Private method to abstract log writing for different types of logs
[ "Private", "method", "to", "abstract", "log", "writing", "for", "different", "types", "of", "logs" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/SettingsDebug.py#L117-L137
6,764
glitchassassin/lackey
lackey/__init__.py
addImagePath
def addImagePath(new_path): """ Convenience function. Adds a path to the list of paths to search for images. Can be a URL (but must be accessible). """ if os.path.exists(new_path): Settings.ImagePaths.append(new_path) elif "http://" in new_path or "https://" in new_path: request = reque...
python
def addImagePath(new_path): """ Convenience function. Adds a path to the list of paths to search for images. Can be a URL (but must be accessible). """ if os.path.exists(new_path): Settings.ImagePaths.append(new_path) elif "http://" in new_path or "https://" in new_path: request = reque...
[ "def", "addImagePath", "(", "new_path", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "new_path", ")", ":", "Settings", ".", "ImagePaths", ".", "append", "(", "new_path", ")", "elif", "\"http://\"", "in", "new_path", "or", "\"https://\"", "in", ...
Convenience function. Adds a path to the list of paths to search for images. Can be a URL (but must be accessible).
[ "Convenience", "function", ".", "Adds", "a", "path", "to", "the", "list", "of", "paths", "to", "search", "for", "images", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L107-L121
6,765
glitchassassin/lackey
lackey/__init__.py
unzip
def unzip(from_file, to_folder): """ Convenience function. Extracts files from the zip file `fromFile` into the folder `toFolder`. """ with ZipFile(os.path.abspath(from_file), 'r') as to_unzip: to_unzip.extractall(os.path.abspath(to_folder))
python
def unzip(from_file, to_folder): """ Convenience function. Extracts files from the zip file `fromFile` into the folder `toFolder`. """ with ZipFile(os.path.abspath(from_file), 'r') as to_unzip: to_unzip.extractall(os.path.abspath(to_folder))
[ "def", "unzip", "(", "from_file", ",", "to_folder", ")", ":", "with", "ZipFile", "(", "os", ".", "path", ".", "abspath", "(", "from_file", ")", ",", "'r'", ")", "as", "to_unzip", ":", "to_unzip", ".", "extractall", "(", "os", ".", "path", ".", "abspa...
Convenience function. Extracts files from the zip file `fromFile` into the folder `toFolder`.
[ "Convenience", "function", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L146-L151
6,766
glitchassassin/lackey
lackey/__init__.py
popup
def popup(text, title="Lackey Info"): """ Creates an info dialog with the specified text. """ root = tk.Tk() root.withdraw() tkMessageBox.showinfo(title, text)
python
def popup(text, title="Lackey Info"): """ Creates an info dialog with the specified text. """ root = tk.Tk() root.withdraw() tkMessageBox.showinfo(title, text)
[ "def", "popup", "(", "text", ",", "title", "=", "\"Lackey Info\"", ")", ":", "root", "=", "tk", ".", "Tk", "(", ")", "root", ".", "withdraw", "(", ")", "tkMessageBox", ".", "showinfo", "(", "title", ",", "text", ")" ]
Creates an info dialog with the specified text.
[ "Creates", "an", "info", "dialog", "with", "the", "specified", "text", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L176-L180
6,767
glitchassassin/lackey
lackey/__init__.py
popError
def popError(text, title="Lackey Error"): """ Creates an error dialog with the specified text. """ root = tk.Tk() root.withdraw() tkMessageBox.showerror(title, text)
python
def popError(text, title="Lackey Error"): """ Creates an error dialog with the specified text. """ root = tk.Tk() root.withdraw() tkMessageBox.showerror(title, text)
[ "def", "popError", "(", "text", ",", "title", "=", "\"Lackey Error\"", ")", ":", "root", "=", "tk", ".", "Tk", "(", ")", "root", ".", "withdraw", "(", ")", "tkMessageBox", ".", "showerror", "(", "title", ",", "text", ")" ]
Creates an error dialog with the specified text.
[ "Creates", "an", "error", "dialog", "with", "the", "specified", "text", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L181-L185
6,768
glitchassassin/lackey
lackey/__init__.py
popAsk
def popAsk(text, title="Lackey Decision"): """ Creates a yes-no dialog with the specified text. """ root = tk.Tk() root.withdraw() return tkMessageBox.askyesno(title, text)
python
def popAsk(text, title="Lackey Decision"): """ Creates a yes-no dialog with the specified text. """ root = tk.Tk() root.withdraw() return tkMessageBox.askyesno(title, text)
[ "def", "popAsk", "(", "text", ",", "title", "=", "\"Lackey Decision\"", ")", ":", "root", "=", "tk", ".", "Tk", "(", ")", "root", ".", "withdraw", "(", ")", "return", "tkMessageBox", ".", "askyesno", "(", "title", ",", "text", ")" ]
Creates a yes-no dialog with the specified text.
[ "Creates", "a", "yes", "-", "no", "dialog", "with", "the", "specified", "text", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L186-L190
6,769
glitchassassin/lackey
lackey/__init__.py
input
def input(msg="", default="", title="Lackey Input", hidden=False): """ Creates an input dialog with the specified message and default text. If `hidden`, creates a password dialog instead. Returns the entered value. """ root = tk.Tk() input_text = tk.StringVar() input_text.set(default) PopupInpu...
python
def input(msg="", default="", title="Lackey Input", hidden=False): """ Creates an input dialog with the specified message and default text. If `hidden`, creates a password dialog instead. Returns the entered value. """ root = tk.Tk() input_text = tk.StringVar() input_text.set(default) PopupInpu...
[ "def", "input", "(", "msg", "=", "\"\"", ",", "default", "=", "\"\"", ",", "title", "=", "\"Lackey Input\"", ",", "hidden", "=", "False", ")", ":", "root", "=", "tk", ".", "Tk", "(", ")", "input_text", "=", "tk", ".", "StringVar", "(", ")", "input_...
Creates an input dialog with the specified message and default text. If `hidden`, creates a password dialog instead. Returns the entered value.
[ "Creates", "an", "input", "dialog", "with", "the", "specified", "message", "and", "default", "text", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L193-L203
6,770
glitchassassin/lackey
lackey/__init__.py
inputText
def inputText(message="", title="Lackey Input", lines=9, width=20, text=""): """ Creates a textarea dialog with the specified message and default text. Returns the entered value. """ root = tk.Tk() input_text = tk.StringVar() input_text.set(text) PopupTextarea(root, message, title, lines, width...
python
def inputText(message="", title="Lackey Input", lines=9, width=20, text=""): """ Creates a textarea dialog with the specified message and default text. Returns the entered value. """ root = tk.Tk() input_text = tk.StringVar() input_text.set(text) PopupTextarea(root, message, title, lines, width...
[ "def", "inputText", "(", "message", "=", "\"\"", ",", "title", "=", "\"Lackey Input\"", ",", "lines", "=", "9", ",", "width", "=", "20", ",", "text", "=", "\"\"", ")", ":", "root", "=", "tk", ".", "Tk", "(", ")", "input_text", "=", "tk", ".", "St...
Creates a textarea dialog with the specified message and default text. Returns the entered value.
[ "Creates", "a", "textarea", "dialog", "with", "the", "specified", "message", "and", "default", "text", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L204-L214
6,771
glitchassassin/lackey
lackey/__init__.py
select
def select(message="", title="Lackey Input", options=None, default=None): """ Creates a dropdown selection dialog with the specified message and options `default` must be one of the options. Returns the selected value. """ if options is None or len(options) == 0: return "" if default is ...
python
def select(message="", title="Lackey Input", options=None, default=None): """ Creates a dropdown selection dialog with the specified message and options `default` must be one of the options. Returns the selected value. """ if options is None or len(options) == 0: return "" if default is ...
[ "def", "select", "(", "message", "=", "\"\"", ",", "title", "=", "\"Lackey Input\"", ",", "options", "=", "None", ",", "default", "=", "None", ")", ":", "if", "options", "is", "None", "or", "len", "(", "options", ")", "==", "0", ":", "return", "\"\""...
Creates a dropdown selection dialog with the specified message and options `default` must be one of the options. Returns the selected value.
[ "Creates", "a", "dropdown", "selection", "dialog", "with", "the", "specified", "message", "and", "options" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L215-L233
6,772
glitchassassin/lackey
lackey/__init__.py
popFile
def popFile(title="Lackey Open File"): """ Creates a file selection dialog with the specified message and options. Returns the selected file. """ root = tk.Tk() root.withdraw() return str(tkFileDialog.askopenfilename(title=title))
python
def popFile(title="Lackey Open File"): """ Creates a file selection dialog with the specified message and options. Returns the selected file. """ root = tk.Tk() root.withdraw() return str(tkFileDialog.askopenfilename(title=title))
[ "def", "popFile", "(", "title", "=", "\"Lackey Open File\"", ")", ":", "root", "=", "tk", ".", "Tk", "(", ")", "root", ".", "withdraw", "(", ")", "return", "str", "(", "tkFileDialog", ".", "askopenfilename", "(", "title", "=", "title", ")", ")" ]
Creates a file selection dialog with the specified message and options. Returns the selected file.
[ "Creates", "a", "file", "selection", "dialog", "with", "the", "specified", "message", "and", "options", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/__init__.py#L234-L240
6,773
glitchassassin/lackey
lackey/Geometry.py
Location.setLocation
def setLocation(self, x, y): """Set the location of this object to the specified coordinates.""" self.x = int(x) self.y = int(y) return self
python
def setLocation(self, x, y): """Set the location of this object to the specified coordinates.""" self.x = int(x) self.y = int(y) return self
[ "def", "setLocation", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "x", "=", "int", "(", "x", ")", "self", ".", "y", "=", "int", "(", "y", ")", "return", "self" ]
Set the location of this object to the specified coordinates.
[ "Set", "the", "location", "of", "this", "object", "to", "the", "specified", "coordinates", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/Geometry.py#L15-L19
6,774
glitchassassin/lackey
lackey/Geometry.py
Location.offset
def offset(self, dx, dy): """Get a new location which is dx and dy pixels away horizontally and vertically from the current location. """ return Location(self.x+dx, self.y+dy)
python
def offset(self, dx, dy): """Get a new location which is dx and dy pixels away horizontally and vertically from the current location. """ return Location(self.x+dx, self.y+dy)
[ "def", "offset", "(", "self", ",", "dx", ",", "dy", ")", ":", "return", "Location", "(", "self", ".", "x", "+", "dx", ",", "self", ".", "y", "+", "dy", ")" ]
Get a new location which is dx and dy pixels away horizontally and vertically from the current location.
[ "Get", "a", "new", "location", "which", "is", "dx", "and", "dy", "pixels", "away", "horizontally", "and", "vertically", "from", "the", "current", "location", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/Geometry.py#L22-L26
6,775
glitchassassin/lackey
lackey/Geometry.py
Location.getOffset
def getOffset(self, loc): """ Returns the offset between the given point and this point """ return Location(loc.x - self.x, loc.y - self.y)
python
def getOffset(self, loc): """ Returns the offset between the given point and this point """ return Location(loc.x - self.x, loc.y - self.y)
[ "def", "getOffset", "(", "self", ",", "loc", ")", ":", "return", "Location", "(", "loc", ".", "x", "-", "self", ".", "x", ",", "loc", ".", "y", "-", "self", ".", "y", ")" ]
Returns the offset between the given point and this point
[ "Returns", "the", "offset", "between", "the", "given", "point", "and", "this", "point" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/Geometry.py#L71-L73
6,776
glitchassassin/lackey
lackey/Geometry.py
Location.copyTo
def copyTo(self, screen): """ Creates a new point with the same offset on the target screen as this point has on the current screen """ from .RegionMatching import Screen if not isinstance(screen, Screen): screen = RegionMatching.Screen(screen) return screen.getTopLef...
python
def copyTo(self, screen): """ Creates a new point with the same offset on the target screen as this point has on the current screen """ from .RegionMatching import Screen if not isinstance(screen, Screen): screen = RegionMatching.Screen(screen) return screen.getTopLef...
[ "def", "copyTo", "(", "self", ",", "screen", ")", ":", "from", ".", "RegionMatching", "import", "Screen", "if", "not", "isinstance", "(", "screen", ",", "Screen", ")", ":", "screen", "=", "RegionMatching", ".", "Screen", "(", "screen", ")", "return", "sc...
Creates a new point with the same offset on the target screen as this point has on the current screen
[ "Creates", "a", "new", "point", "with", "the", "same", "offset", "on", "the", "target", "screen", "as", "this", "point", "has", "on", "the", "current", "screen" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/Geometry.py#L96-L102
6,777
glitchassassin/lackey
lackey/App.py
App.focusedWindow
def focusedWindow(cls): """ Returns a Region corresponding to whatever window is in the foreground """ x, y, w, h = PlatformManager.getWindowRect(PlatformManager.getForegroundWindow()) return Region(x, y, w, h)
python
def focusedWindow(cls): """ Returns a Region corresponding to whatever window is in the foreground """ x, y, w, h = PlatformManager.getWindowRect(PlatformManager.getForegroundWindow()) return Region(x, y, w, h)
[ "def", "focusedWindow", "(", "cls", ")", ":", "x", ",", "y", ",", "w", ",", "h", "=", "PlatformManager", ".", "getWindowRect", "(", "PlatformManager", ".", "getForegroundWindow", "(", ")", ")", "return", "Region", "(", "x", ",", "y", ",", "w", ",", "...
Returns a Region corresponding to whatever window is in the foreground
[ "Returns", "a", "Region", "corresponding", "to", "whatever", "window", "is", "in", "the", "foreground" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/App.py#L182-L185
6,778
glitchassassin/lackey
lackey/App.py
App.getWindow
def getWindow(self): """ Returns the title of the main window of the currently open app. Returns an empty string if no match could be found. """ if self.getPID() != -1: return PlatformManager.getWindowTitle(PlatformManager.getWindowByPID(self.getPID())) else: ...
python
def getWindow(self): """ Returns the title of the main window of the currently open app. Returns an empty string if no match could be found. """ if self.getPID() != -1: return PlatformManager.getWindowTitle(PlatformManager.getWindowByPID(self.getPID())) else: ...
[ "def", "getWindow", "(", "self", ")", ":", "if", "self", ".", "getPID", "(", ")", "!=", "-", "1", ":", "return", "PlatformManager", ".", "getWindowTitle", "(", "PlatformManager", ".", "getWindowByPID", "(", "self", ".", "getPID", "(", ")", ")", ")", "e...
Returns the title of the main window of the currently open app. Returns an empty string if no match could be found.
[ "Returns", "the", "title", "of", "the", "main", "window", "of", "the", "currently", "open", "app", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/App.py#L187-L195
6,779
glitchassassin/lackey
lackey/App.py
App.window
def window(self, windowNum=0): """ Returns the region corresponding to the specified window of the app. Defaults to the first window found for the corresponding PID. """ if self._pid == -1: return None x,y,w,h = PlatformManager.getWindowRect(PlatformManager.getWindow...
python
def window(self, windowNum=0): """ Returns the region corresponding to the specified window of the app. Defaults to the first window found for the corresponding PID. """ if self._pid == -1: return None x,y,w,h = PlatformManager.getWindowRect(PlatformManager.getWindow...
[ "def", "window", "(", "self", ",", "windowNum", "=", "0", ")", ":", "if", "self", ".", "_pid", "==", "-", "1", ":", "return", "None", "x", ",", "y", ",", "w", ",", "h", "=", "PlatformManager", ".", "getWindowRect", "(", "PlatformManager", ".", "get...
Returns the region corresponding to the specified window of the app. Defaults to the first window found for the corresponding PID.
[ "Returns", "the", "region", "corresponding", "to", "the", "specified", "window", "of", "the", "app", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/App.py#L220-L228
6,780
glitchassassin/lackey
lackey/App.py
App.isRunning
def isRunning(self, waitTime=0): """ If PID isn't set yet, checks if there is a window with the specified title. """ waitUntil = time.time() + waitTime while True: if self.getPID() > 0: return True else: self._pid = PlatformManager.getWindo...
python
def isRunning(self, waitTime=0): """ If PID isn't set yet, checks if there is a window with the specified title. """ waitUntil = time.time() + waitTime while True: if self.getPID() > 0: return True else: self._pid = PlatformManager.getWindo...
[ "def", "isRunning", "(", "self", ",", "waitTime", "=", "0", ")", ":", "waitUntil", "=", "time", ".", "time", "(", ")", "+", "waitTime", "while", "True", ":", "if", "self", ".", "getPID", "(", ")", ">", "0", ":", "return", "True", "else", ":", "se...
If PID isn't set yet, checks if there is a window with the specified title.
[ "If", "PID", "isn", "t", "set", "yet", "checks", "if", "there", "is", "a", "window", "with", "the", "specified", "title", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/App.py#L237-L251
6,781
glitchassassin/lackey
lackey/PlatformManagerDarwin.py
PlatformManagerDarwin._getVirtualScreenBitmap
def _getVirtualScreenBitmap(self): """ Returns a bitmap of all attached screens """ filenames = [] screen_details = self.getScreenDetails() for screen in screen_details: fh, filepath = tempfile.mkstemp('.png') filenames.append(filepath) os.close(fh) ...
python
def _getVirtualScreenBitmap(self): """ Returns a bitmap of all attached screens """ filenames = [] screen_details = self.getScreenDetails() for screen in screen_details: fh, filepath = tempfile.mkstemp('.png') filenames.append(filepath) os.close(fh) ...
[ "def", "_getVirtualScreenBitmap", "(", "self", ")", ":", "filenames", "=", "[", "]", "screen_details", "=", "self", ".", "getScreenDetails", "(", ")", "for", "screen", "in", "screen_details", ":", "fh", ",", "filepath", "=", "tempfile", ".", "mkstemp", "(", ...
Returns a bitmap of all attached screens
[ "Returns", "a", "bitmap", "of", "all", "attached", "screens" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerDarwin.py#L228-L254
6,782
glitchassassin/lackey
lackey/PlatformManagerDarwin.py
PlatformManagerDarwin.osCopy
def osCopy(self): """ Triggers the OS "copy" keyboard shortcut """ k = Keyboard() k.keyDown("{CTRL}") k.type("c") k.keyUp("{CTRL}")
python
def osCopy(self): """ Triggers the OS "copy" keyboard shortcut """ k = Keyboard() k.keyDown("{CTRL}") k.type("c") k.keyUp("{CTRL}")
[ "def", "osCopy", "(", "self", ")", ":", "k", "=", "Keyboard", "(", ")", "k", ".", "keyDown", "(", "\"{CTRL}\"", ")", "k", ".", "type", "(", "\"c\"", ")", "k", ".", "keyUp", "(", "\"{CTRL}\"", ")" ]
Triggers the OS "copy" keyboard shortcut
[ "Triggers", "the", "OS", "copy", "keyboard", "shortcut" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerDarwin.py#L287-L292
6,783
glitchassassin/lackey
lackey/PlatformManagerDarwin.py
PlatformManagerDarwin.getForegroundWindow
def getForegroundWindow(self): """ Returns a handle to the window in the foreground """ active_app = NSWorkspace.sharedWorkspace().frontmostApplication().localizedName() for w in self._get_window_list(): if "kCGWindowOwnerName" in w and w["kCGWindowOwnerName"] == active_app: ...
python
def getForegroundWindow(self): """ Returns a handle to the window in the foreground """ active_app = NSWorkspace.sharedWorkspace().frontmostApplication().localizedName() for w in self._get_window_list(): if "kCGWindowOwnerName" in w and w["kCGWindowOwnerName"] == active_app: ...
[ "def", "getForegroundWindow", "(", "self", ")", ":", "active_app", "=", "NSWorkspace", ".", "sharedWorkspace", "(", ")", ".", "frontmostApplication", "(", ")", ".", "localizedName", "(", ")", "for", "w", "in", "self", ".", "_get_window_list", "(", ")", ":", ...
Returns a handle to the window in the foreground
[ "Returns", "a", "handle", "to", "the", "window", "in", "the", "foreground" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerDarwin.py#L347-L352
6,784
glitchassassin/lackey
lackey/PlatformManagerDarwin.py
PlatformManagerDarwin._get_window_list
def _get_window_list(self): """ Returns a dictionary of details about open windows """ window_list = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID) return window_list
python
def _get_window_list(self): """ Returns a dictionary of details about open windows """ window_list = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID) return window_list
[ "def", "_get_window_list", "(", "self", ")", ":", "window_list", "=", "Quartz", ".", "CGWindowListCopyWindowInfo", "(", "Quartz", ".", "kCGWindowListExcludeDesktopElements", ",", "Quartz", ".", "kCGNullWindowID", ")", "return", "window_list" ]
Returns a dictionary of details about open windows
[ "Returns", "a", "dictionary", "of", "details", "about", "open", "windows" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerDarwin.py#L354-L357
6,785
glitchassassin/lackey
lackey/PlatformManagerDarwin.py
PlatformManagerDarwin.getProcessName
def getProcessName(self, pid): """ Searches all processes for the given PID, then returns the originating command """ ps = subprocess.check_output(["ps", "aux"]).decode("ascii") processes = ps.split("\n") cols = len(processes[0].split()) - 1 for row in processes[1:]: ...
python
def getProcessName(self, pid): """ Searches all processes for the given PID, then returns the originating command """ ps = subprocess.check_output(["ps", "aux"]).decode("ascii") processes = ps.split("\n") cols = len(processes[0].split()) - 1 for row in processes[1:]: ...
[ "def", "getProcessName", "(", "self", ",", "pid", ")", ":", "ps", "=", "subprocess", ".", "check_output", "(", "[", "\"ps\"", ",", "\"aux\"", "]", ")", ".", "decode", "(", "\"ascii\"", ")", "processes", "=", "ps", ".", "split", "(", "\"\\n\"", ")", "...
Searches all processes for the given PID, then returns the originating command
[ "Searches", "all", "processes", "for", "the", "given", "PID", "then", "returns", "the", "originating", "command" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerDarwin.py#L407-L416
6,786
glitchassassin/lackey
lackey/InputEmulation.py
Mouse.moveSpeed
def moveSpeed(self, location, seconds=0.3): """ Moves cursor to specified ``Location`` over ``seconds``. If ``seconds`` is 0, moves the cursor immediately. Used for smooth somewhat-human-like motion. """ self._lock.acquire() original_location = mouse.get_position() ...
python
def moveSpeed(self, location, seconds=0.3): """ Moves cursor to specified ``Location`` over ``seconds``. If ``seconds`` is 0, moves the cursor immediately. Used for smooth somewhat-human-like motion. """ self._lock.acquire() original_location = mouse.get_position() ...
[ "def", "moveSpeed", "(", "self", ",", "location", ",", "seconds", "=", "0.3", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "original_location", "=", "mouse", ".", "get_position", "(", ")", "mouse", ".", "move", "(", "location", ".", "x", ...
Moves cursor to specified ``Location`` over ``seconds``. If ``seconds`` is 0, moves the cursor immediately. Used for smooth somewhat-human-like motion.
[ "Moves", "cursor", "to", "specified", "Location", "over", "seconds", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L59-L73
6,787
glitchassassin/lackey
lackey/InputEmulation.py
Mouse.click
def click(self, loc=None, button=mouse.LEFT): """ Clicks the specified mouse button. If ``loc`` is set, move the mouse to that Location first. Use button constants Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT """ if loc is not None: self.moveSpeed(loc) self._lock.a...
python
def click(self, loc=None, button=mouse.LEFT): """ Clicks the specified mouse button. If ``loc`` is set, move the mouse to that Location first. Use button constants Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT """ if loc is not None: self.moveSpeed(loc) self._lock.a...
[ "def", "click", "(", "self", ",", "loc", "=", "None", ",", "button", "=", "mouse", ".", "LEFT", ")", ":", "if", "loc", "is", "not", "None", ":", "self", ".", "moveSpeed", "(", "loc", ")", "self", ".", "_lock", ".", "acquire", "(", ")", "mouse", ...
Clicks the specified mouse button. If ``loc`` is set, move the mouse to that Location first. Use button constants Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT
[ "Clicks", "the", "specified", "mouse", "button", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L75-L86
6,788
glitchassassin/lackey
lackey/InputEmulation.py
Mouse.buttonDown
def buttonDown(self, button=mouse.LEFT): """ Holds down the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT """ self._lock.acquire() mouse.press(button) self._lock.release()
python
def buttonDown(self, button=mouse.LEFT): """ Holds down the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT """ self._lock.acquire() mouse.press(button) self._lock.release()
[ "def", "buttonDown", "(", "self", ",", "button", "=", "mouse", ".", "LEFT", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "mouse", ".", "press", "(", "button", ")", "self", ".", "_lock", ".", "release", "(", ")" ]
Holds down the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT
[ "Holds", "down", "the", "specified", "mouse", "button", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L87-L94
6,789
glitchassassin/lackey
lackey/InputEmulation.py
Mouse.buttonUp
def buttonUp(self, button=mouse.LEFT): """ Releases the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT """ self._lock.acquire() mouse.release(button) self._lock.release()
python
def buttonUp(self, button=mouse.LEFT): """ Releases the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT """ self._lock.acquire() mouse.release(button) self._lock.release()
[ "def", "buttonUp", "(", "self", ",", "button", "=", "mouse", ".", "LEFT", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "mouse", ".", "release", "(", "button", ")", "self", ".", "_lock", ".", "release", "(", ")" ]
Releases the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT
[ "Releases", "the", "specified", "mouse", "button", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L96-L103
6,790
glitchassassin/lackey
lackey/InputEmulation.py
Mouse.wheel
def wheel(self, direction, steps): """ Clicks the wheel the specified number of steps in the given direction. Use Mouse.WHEEL_DOWN, Mouse.WHEEL_UP """ self._lock.acquire() if direction == 1: wheel_moved = steps elif direction == 0: wheel_moved = -...
python
def wheel(self, direction, steps): """ Clicks the wheel the specified number of steps in the given direction. Use Mouse.WHEEL_DOWN, Mouse.WHEEL_UP """ self._lock.acquire() if direction == 1: wheel_moved = steps elif direction == 0: wheel_moved = -...
[ "def", "wheel", "(", "self", ",", "direction", ",", "steps", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "if", "direction", "==", "1", ":", "wheel_moved", "=", "steps", "elif", "direction", "==", "0", ":", "wheel_moved", "=", "-", "1", ...
Clicks the wheel the specified number of steps in the given direction. Use Mouse.WHEEL_DOWN, Mouse.WHEEL_UP
[ "Clicks", "the", "wheel", "the", "specified", "number", "of", "steps", "in", "the", "given", "direction", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L105-L118
6,791
glitchassassin/lackey
lackey/InputEmulation.py
Keyboard.type
def type(self, text, delay=0.1): """ Translates a string into a series of keystrokes. Respects Sikuli special codes, like "{ENTER}". """ in_special_code = False special_code = "" modifier_held = False modifier_stuck = False modifier_codes = [] fo...
python
def type(self, text, delay=0.1): """ Translates a string into a series of keystrokes. Respects Sikuli special codes, like "{ENTER}". """ in_special_code = False special_code = "" modifier_held = False modifier_stuck = False modifier_codes = [] fo...
[ "def", "type", "(", "self", ",", "text", ",", "delay", "=", "0.1", ")", ":", "in_special_code", "=", "False", "special_code", "=", "\"\"", "modifier_held", "=", "False", "modifier_stuck", "=", "False", "modifier_codes", "=", "[", "]", "for", "i", "in", "...
Translates a string into a series of keystrokes. Respects Sikuli special codes, like "{ENTER}".
[ "Translates", "a", "string", "into", "a", "series", "of", "keystrokes", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L347-L385
6,792
glitchassassin/lackey
lackey/TemplateMatchers.py
NaiveTemplateMatcher.findBestMatch
def findBestMatch(self, needle, similarity): """ Find the best match for ``needle`` that has a similarity better than or equal to ``similarity``. Returns a tuple of ``(position, confidence)`` if a match is found, or ``None`` otherwise. *Developer's Note - Despite the name, this method actually...
python
def findBestMatch(self, needle, similarity): """ Find the best match for ``needle`` that has a similarity better than or equal to ``similarity``. Returns a tuple of ``(position, confidence)`` if a match is found, or ``None`` otherwise. *Developer's Note - Despite the name, this method actually...
[ "def", "findBestMatch", "(", "self", ",", "needle", ",", "similarity", ")", ":", "method", "=", "cv2", ".", "TM_CCOEFF_NORMED", "position", "=", "None", "match", "=", "cv2", ".", "matchTemplate", "(", "self", ".", "haystack", ",", "needle", ",", "method", ...
Find the best match for ``needle`` that has a similarity better than or equal to ``similarity``. Returns a tuple of ``(position, confidence)`` if a match is found, or ``None`` otherwise. *Developer's Note - Despite the name, this method actually returns the **first** result with enough similar...
[ "Find", "the", "best", "match", "for", "needle", "that", "has", "a", "similarity", "better", "than", "or", "equal", "to", "similarity", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/TemplateMatchers.py#L16-L43
6,793
glitchassassin/lackey
lackey/TemplateMatchers.py
NaiveTemplateMatcher.findAllMatches
def findAllMatches(self, needle, similarity): """ Find all matches for ``needle`` with confidence better than or equal to ``similarity``. Returns an array of tuples ``(position, confidence)`` if match(es) is/are found, or an empty array otherwise. """ positions = [] meth...
python
def findAllMatches(self, needle, similarity): """ Find all matches for ``needle`` with confidence better than or equal to ``similarity``. Returns an array of tuples ``(position, confidence)`` if match(es) is/are found, or an empty array otherwise. """ positions = [] meth...
[ "def", "findAllMatches", "(", "self", ",", "needle", ",", "similarity", ")", ":", "positions", "=", "[", "]", "method", "=", "cv2", ".", "TM_CCOEFF_NORMED", "match", "=", "cv2", ".", "matchTemplate", "(", "self", ".", "haystack", ",", "self", ".", "needl...
Find all matches for ``needle`` with confidence better than or equal to ``similarity``. Returns an array of tuples ``(position, confidence)`` if match(es) is/are found, or an empty array otherwise.
[ "Find", "all", "matches", "for", "needle", "with", "confidence", "better", "than", "or", "equal", "to", "similarity", "." ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/TemplateMatchers.py#L45-L69
6,794
glitchassassin/lackey
lackey/TemplateMatchers.py
PyramidTemplateMatcher.findAllMatches
def findAllMatches(self, needle, similarity): """ Finds all matches above ``similarity`` using a search pyramid to improve efficiency Pyramid implementation unashamedly stolen from https://github.com/stb-tester/stb-tester """ positions = [] # Use findBestMatch to get the best ma...
python
def findAllMatches(self, needle, similarity): """ Finds all matches above ``similarity`` using a search pyramid to improve efficiency Pyramid implementation unashamedly stolen from https://github.com/stb-tester/stb-tester """ positions = [] # Use findBestMatch to get the best ma...
[ "def", "findAllMatches", "(", "self", ",", "needle", ",", "similarity", ")", ":", "positions", "=", "[", "]", "# Use findBestMatch to get the best match", "while", "True", ":", "best_match", "=", "self", ".", "findBestMatch", "(", "needle", ",", "similarity", ")...
Finds all matches above ``similarity`` using a search pyramid to improve efficiency Pyramid implementation unashamedly stolen from https://github.com/stb-tester/stb-tester
[ "Finds", "all", "matches", "above", "similarity", "using", "a", "search", "pyramid", "to", "improve", "efficiency" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/TemplateMatchers.py#L218-L244
6,795
glitchassassin/lackey
lackey/TemplateMatchers.py
PyramidTemplateMatcher._build_pyramid
def _build_pyramid(self, image, levels): """ Returns a list of reduced-size images, from smallest to original size """ pyramid = [image] for l in range(levels-1): if any(x < 20 for x in pyramid[-1].shape[:2]): break pyramid.append(cv2.pyrDown(pyramid[-1]))...
python
def _build_pyramid(self, image, levels): """ Returns a list of reduced-size images, from smallest to original size """ pyramid = [image] for l in range(levels-1): if any(x < 20 for x in pyramid[-1].shape[:2]): break pyramid.append(cv2.pyrDown(pyramid[-1]))...
[ "def", "_build_pyramid", "(", "self", ",", "image", ",", "levels", ")", ":", "pyramid", "=", "[", "image", "]", "for", "l", "in", "range", "(", "levels", "-", "1", ")", ":", "if", "any", "(", "x", "<", "20", "for", "x", "in", "pyramid", "[", "-...
Returns a list of reduced-size images, from smallest to original size
[ "Returns", "a", "list", "of", "reduced", "-", "size", "images", "from", "smallest", "to", "original", "size" ]
7adadfacd7f45d81186710be992f5668b15399fe
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/TemplateMatchers.py#L246-L253
6,796
google-research/batch-ppo
agents/tools/count_weights.py
count_weights
def count_weights(scope=None, exclude=None, graph=None): """Count learnable parameters. Args: scope: Restrict the count to a variable scope. exclude: Regex to match variable names to exclude. graph: Operate on a graph other than the current default graph. Returns: Number of learnable parameters ...
python
def count_weights(scope=None, exclude=None, graph=None): """Count learnable parameters. Args: scope: Restrict the count to a variable scope. exclude: Regex to match variable names to exclude. graph: Operate on a graph other than the current default graph. Returns: Number of learnable parameters ...
[ "def", "count_weights", "(", "scope", "=", "None", ",", "exclude", "=", "None", ",", "graph", "=", "None", ")", ":", "if", "scope", ":", "scope", "=", "scope", "if", "scope", ".", "endswith", "(", "'/'", ")", "else", "scope", "+", "'/'", "graph", "...
Count learnable parameters. Args: scope: Restrict the count to a variable scope. exclude: Regex to match variable names to exclude. graph: Operate on a graph other than the current default graph. Returns: Number of learnable parameters as integer.
[ "Count", "learnable", "parameters", "." ]
3d09705977bae4e7c3eb20339a3b384d2a5531e4
https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/tools/count_weights.py#L27-L48
6,797
google-research/batch-ppo
agents/scripts/networks.py
_custom_diag_normal_kl
def _custom_diag_normal_kl(lhs, rhs, name=None): # pylint: disable=unused-argument """Empirical KL divergence of two normals with diagonal covariance. Args: lhs: Diagonal Normal distribution. rhs: Diagonal Normal distribution. name: Name scope for the op. Returns: KL divergence from lhs to rhs....
python
def _custom_diag_normal_kl(lhs, rhs, name=None): # pylint: disable=unused-argument """Empirical KL divergence of two normals with diagonal covariance. Args: lhs: Diagonal Normal distribution. rhs: Diagonal Normal distribution. name: Name scope for the op. Returns: KL divergence from lhs to rhs....
[ "def", "_custom_diag_normal_kl", "(", "lhs", ",", "rhs", ",", "name", "=", "None", ")", ":", "# pylint: disable=unused-argument", "with", "tf", ".", "name_scope", "(", "name", "or", "'kl_divergence'", ")", ":", "mean0", "=", "lhs", ".", "mean", "(", ")", "...
Empirical KL divergence of two normals with diagonal covariance. Args: lhs: Diagonal Normal distribution. rhs: Diagonal Normal distribution. name: Name scope for the op. Returns: KL divergence from lhs to rhs.
[ "Empirical", "KL", "divergence", "of", "two", "normals", "with", "diagonal", "covariance", "." ]
3d09705977bae4e7c3eb20339a3b384d2a5531e4
https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/scripts/networks.py#L43-L64
6,798
google-research/batch-ppo
agents/scripts/utility.py
define_simulation_graph
def define_simulation_graph(batch_env, algo_cls, config): """Define the algorithm and environment interaction. Args: batch_env: In-graph environments object. algo_cls: Constructor of a batch algorithm. config: Configuration object for the algorithm. Returns: Object providing graph elements via a...
python
def define_simulation_graph(batch_env, algo_cls, config): """Define the algorithm and environment interaction. Args: batch_env: In-graph environments object. algo_cls: Constructor of a batch algorithm. config: Configuration object for the algorithm. Returns: Object providing graph elements via a...
[ "def", "define_simulation_graph", "(", "batch_env", ",", "algo_cls", ",", "config", ")", ":", "# pylint: disable=unused-variable", "step", "=", "tf", ".", "Variable", "(", "0", ",", "False", ",", "dtype", "=", "tf", ".", "int32", ",", "name", "=", "'global_s...
Define the algorithm and environment interaction. Args: batch_env: In-graph environments object. algo_cls: Constructor of a batch algorithm. config: Configuration object for the algorithm. Returns: Object providing graph elements via attributes.
[ "Define", "the", "algorithm", "and", "environment", "interaction", "." ]
3d09705977bae4e7c3eb20339a3b384d2a5531e4
https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/scripts/utility.py#L31-L54
6,799
google-research/batch-ppo
agents/scripts/utility.py
define_batch_env
def define_batch_env(constructor, num_agents, env_processes): """Create environments and apply all desired wrappers. Args: constructor: Constructor of an OpenAI gym environment. num_agents: Number of environments to combine in the batch. env_processes: Whether to step environment in external processes....
python
def define_batch_env(constructor, num_agents, env_processes): """Create environments and apply all desired wrappers. Args: constructor: Constructor of an OpenAI gym environment. num_agents: Number of environments to combine in the batch. env_processes: Whether to step environment in external processes....
[ "def", "define_batch_env", "(", "constructor", ",", "num_agents", ",", "env_processes", ")", ":", "with", "tf", ".", "variable_scope", "(", "'environments'", ")", ":", "if", "env_processes", ":", "envs", "=", "[", "tools", ".", "wrappers", ".", "ExternalProces...
Create environments and apply all desired wrappers. Args: constructor: Constructor of an OpenAI gym environment. num_agents: Number of environments to combine in the batch. env_processes: Whether to step environment in external processes. Returns: In-graph environments object.
[ "Create", "environments", "and", "apply", "all", "desired", "wrappers", "." ]
3d09705977bae4e7c3eb20339a3b384d2a5531e4
https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/scripts/utility.py#L57-L77