repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
asweigart/pyautogui
pyautogui/_pyautogui_x11.py
_keyUp
def _keyUp(key): """Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in pyautogui.KEY_NAMES. Returns: None """ """ Release a given character key. Also works with character keycodes as ...
python
def _keyUp(key): """Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in pyautogui.KEY_NAMES. Returns: None """ """ Release a given character key. Also works with character keycodes as ...
[ "def", "_keyUp", "(", "key", ")", ":", "\"\"\"\n Release a given character key. Also works with character keycodes as\n integers, but not keysyms.\n \"\"\"", "if", "key", "not", "in", "keyboardMapping", "or", "keyboardMapping", "[", "key", "]", "is", "None", ":", "re...
Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in pyautogui.KEY_NAMES. Returns: None
[ "Performs", "a", "keyboard", "key", "release", "(", "without", "the", "press", "down", "beforehand", ")", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_x11.py#L132-L156
train
asweigart/pyautogui
pyautogui/_window_win.py
getWindows
def getWindows(): #https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/ """Return dict: {'window title' : window handle} for all visible windows""" titles = {} def foreach_window(hwnd, lparam): if IsWindowVisible(hwnd): length = GetWindowTextLength(hwnd)...
python
def getWindows(): #https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/ """Return dict: {'window title' : window handle} for all visible windows""" titles = {} def foreach_window(hwnd, lparam): if IsWindowVisible(hwnd): length = GetWindowTextLength(hwnd)...
[ "def", "getWindows", "(", ")", ":", "#https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/", "titles", "=", "{", "}", "def", "foreach_window", "(", "hwnd", ",", "lparam", ")", ":", "if", "IsWindowVisible", "(", "hwnd", ")", ":", "length",...
Return dict: {'window title' : window handle} for all visible windows
[ "Return", "dict", ":", "{", "window", "title", ":", "window", "handle", "}", "for", "all", "visible", "windows" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L84-L97
train
asweigart/pyautogui
pyautogui/_window_win.py
getWindow
def getWindow(title, exact=False): """Return Window object if 'title' or its part found in visible windows titles, else return None Return only 1 window found first Args: title: unicode string exact (bool): True if search only exact match """ titles = getWindows() hwnd = titles....
python
def getWindow(title, exact=False): """Return Window object if 'title' or its part found in visible windows titles, else return None Return only 1 window found first Args: title: unicode string exact (bool): True if search only exact match """ titles = getWindows() hwnd = titles....
[ "def", "getWindow", "(", "title", ",", "exact", "=", "False", ")", ":", "titles", "=", "getWindows", "(", ")", "hwnd", "=", "titles", ".", "get", "(", "title", ",", "None", ")", "if", "not", "hwnd", "and", "not", "exact", ":", "for", "k", ",", "v...
Return Window object if 'title' or its part found in visible windows titles, else return None Return only 1 window found first Args: title: unicode string exact (bool): True if search only exact match
[ "Return", "Window", "object", "if", "title", "or", "its", "part", "found", "in", "visible", "windows", "titles", "else", "return", "None" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L99-L117
train
asweigart/pyautogui
pyautogui/_window_win.py
Window.set_position
def set_position(self, x, y, width, height): """Set window top-left corner position and size""" SetWindowPos(self._hwnd, None, x, y, width, height, ctypes.c_uint(0))
python
def set_position(self, x, y, width, height): """Set window top-left corner position and size""" SetWindowPos(self._hwnd, None, x, y, width, height, ctypes.c_uint(0))
[ "def", "set_position", "(", "self", ",", "x", ",", "y", ",", "width", ",", "height", ")", ":", "SetWindowPos", "(", "self", ".", "_hwnd", ",", "None", ",", "x", ",", "y", ",", "width", ",", "height", ",", "ctypes", ".", "c_uint", "(", "0", ")", ...
Set window top-left corner position and size
[ "Set", "window", "top", "-", "left", "corner", "position", "and", "size" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L44-L46
train
asweigart/pyautogui
pyautogui/_window_win.py
Window.move
def move(self, x, y): """Move window top-left corner to position""" SetWindowPos(self._hwnd, None, x, y, 0, 0, SWP_NOSIZE)
python
def move(self, x, y): """Move window top-left corner to position""" SetWindowPos(self._hwnd, None, x, y, 0, 0, SWP_NOSIZE)
[ "def", "move", "(", "self", ",", "x", ",", "y", ")", ":", "SetWindowPos", "(", "self", ".", "_hwnd", ",", "None", ",", "x", ",", "y", ",", "0", ",", "0", ",", "SWP_NOSIZE", ")" ]
Move window top-left corner to position
[ "Move", "window", "top", "-", "left", "corner", "to", "position" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L48-L50
train
asweigart/pyautogui
pyautogui/_window_win.py
Window.resize
def resize(self, width, height): """Change window size""" SetWindowPos(self._hwnd, None, 0, 0, width, height, SWP_NOMOVE)
python
def resize(self, width, height): """Change window size""" SetWindowPos(self._hwnd, None, 0, 0, width, height, SWP_NOMOVE)
[ "def", "resize", "(", "self", ",", "width", ",", "height", ")", ":", "SetWindowPos", "(", "self", ".", "_hwnd", ",", "None", ",", "0", ",", "0", ",", "width", ",", "height", ",", "SWP_NOMOVE", ")" ]
Change window size
[ "Change", "window", "size" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L52-L54
train
asweigart/pyautogui
pyautogui/_window_win.py
Window.get_position
def get_position(self): """Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners""" rect = _Rect() GetWindowRect(self._hwnd, ctypes.pointer(rect)) return rect.left, rect.top, rect.right, rect.bottom
python
def get_position(self): """Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners""" rect = _Rect() GetWindowRect(self._hwnd, ctypes.pointer(rect)) return rect.left, rect.top, rect.right, rect.bottom
[ "def", "get_position", "(", "self", ")", ":", "rect", "=", "_Rect", "(", ")", "GetWindowRect", "(", "self", ".", "_hwnd", ",", "ctypes", ".", "pointer", "(", "rect", ")", ")", "return", "rect", ".", "left", ",", "rect", ".", "top", ",", "rect", "."...
Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners
[ "Returns", "tuple", "of", "4", "numbers", ":", "(", "x", "y", ")", "s", "of", "top", "-", "left", "and", "bottom", "-", "right", "corners" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L71-L75
train
asweigart/pyautogui
pyautogui/__init__.py
getPointOnLine
def getPointOnLine(x1, y1, x2, y2, n): """Returns the (x, y) tuple of the point that has progressed a proportion n along the line defined by the two x, y coordinates. Copied from pytweening module. """ x = ((x2 - x1) * n) + x1 y = ((y2 - y1) * n) + y1 return (x, y)
python
def getPointOnLine(x1, y1, x2, y2, n): """Returns the (x, y) tuple of the point that has progressed a proportion n along the line defined by the two x, y coordinates. Copied from pytweening module. """ x = ((x2 - x1) * n) + x1 y = ((y2 - y1) * n) + y1 return (x, y)
[ "def", "getPointOnLine", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "n", ")", ":", "x", "=", "(", "(", "x2", "-", "x1", ")", "*", "n", ")", "+", "x1", "y", "=", "(", "(", "y2", "-", "y1", ")", "*", "n", ")", "+", "y1", "return", ...
Returns the (x, y) tuple of the point that has progressed a proportion n along the line defined by the two x, y coordinates. Copied from pytweening module.
[ "Returns", "the", "(", "x", "y", ")", "tuple", "of", "the", "point", "that", "has", "progressed", "a", "proportion", "n", "along", "the", "line", "defined", "by", "the", "two", "x", "y", "coordinates", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L179-L187
train
asweigart/pyautogui
pyautogui/__init__.py
_unpackXY
def _unpackXY(x, y): """If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y. On functions that receive a pair of x,y coordinates, they can be passed as separate arguments, or as a single two-element sequence. """ if isinstance(x, str): # x parameter is the string of an ...
python
def _unpackXY(x, y): """If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y. On functions that receive a pair of x,y coordinates, they can be passed as separate arguments, or as a single two-element sequence. """ if isinstance(x, str): # x parameter is the string of an ...
[ "def", "_unpackXY", "(", "x", ",", "y", ")", ":", "if", "isinstance", "(", "x", ",", "str", ")", ":", "# x parameter is the string of an image filename to find and click on:", "x", ",", "y", "=", "center", "(", "locateOnScreen", "(", "x", ")", ")", "elif", "...
If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y. On functions that receive a pair of x,y coordinates, they can be passed as separate arguments, or as a single two-element sequence.
[ "If", "x", "is", "a", "sequence", "and", "y", "is", "None", "returns", "x", "[", "0", "]", "y", "[", "0", "]", ".", "Else", "returns", "x", "y", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L210-L231
train
asweigart/pyautogui
pyautogui/__init__.py
position
def position(x=None, y=None): """Returns the current xy coordinates of the mouse cursor as a two-integer tuple. Args: x (int, None, optional) - If not None, this argument overrides the x in the return value. y (int, None, optional) - If not None, this argument overrides the y in ...
python
def position(x=None, y=None): """Returns the current xy coordinates of the mouse cursor as a two-integer tuple. Args: x (int, None, optional) - If not None, this argument overrides the x in the return value. y (int, None, optional) - If not None, this argument overrides the y in ...
[ "def", "position", "(", "x", "=", "None", ",", "y", "=", "None", ")", ":", "posx", ",", "posy", "=", "platformModule", ".", "_position", "(", ")", "posx", "=", "int", "(", "posx", ")", "posy", "=", "int", "(", "posy", ")", "if", "x", "is", "not...
Returns the current xy coordinates of the mouse cursor as a two-integer tuple. Args: x (int, None, optional) - If not None, this argument overrides the x in the return value. y (int, None, optional) - If not None, this argument overrides the y in the return value. Returns: ...
[ "Returns", "the", "current", "xy", "coordinates", "of", "the", "mouse", "cursor", "as", "a", "two", "-", "integer", "tuple", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L234-L254
train
asweigart/pyautogui
pyautogui/__init__.py
onScreen
def onScreen(x, y=None): """Returns whether the given xy coordinates are on the screen or not. Args: Either the arguments are two separate values, first arg for x and second for y, or there is a single argument of a sequence with two values, the first x and the second y. Example: ...
python
def onScreen(x, y=None): """Returns whether the given xy coordinates are on the screen or not. Args: Either the arguments are two separate values, first arg for x and second for y, or there is a single argument of a sequence with two values, the first x and the second y. Example: ...
[ "def", "onScreen", "(", "x", ",", "y", "=", "None", ")", ":", "x", ",", "y", "=", "_unpackXY", "(", "x", ",", "y", ")", "x", "=", "int", "(", "x", ")", "y", "=", "int", "(", "y", ")", "width", ",", "height", "=", "platformModule", ".", "_si...
Returns whether the given xy coordinates are on the screen or not. Args: Either the arguments are two separate values, first arg for x and second for y, or there is a single argument of a sequence with two values, the first x and the second y. Example: onScreen(x, y) or onScreen([x, y...
[ "Returns", "whether", "the", "given", "xy", "coordinates", "are", "on", "the", "screen", "or", "not", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L266-L284
train
asweigart/pyautogui
pyautogui/__init__.py
mouseUp
def mouseUp(x=None, y=None, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs releasing a mouse button up (but not down beforehand). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down....
python
def mouseUp(x=None, y=None, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs releasing a mouse button up (but not down beforehand). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down....
[ "def", "mouseUp", "(", "x", "=", "None", ",", "y", "=", "None", ",", "button", "=", "'left'", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "if", "button", "not", "in", ...
Performs releasing a mouse button up (but not down beforehand). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the screen. Args: ...
[ "Performs", "releasing", "a", "mouse", "button", "up", "(", "but", "not", "down", "beforehand", ")", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L334-L375
train
asweigart/pyautogui
pyautogui/__init__.py
click
def click(x=None, y=None, clicks=1, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs pressing a mouse button down and then immediately releasing it. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a f...
python
def click(x=None, y=None, clicks=1, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs pressing a mouse button down and then immediately releasing it. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a f...
[ "def", "click", "(", "x", "=", "None", ",", "y", "=", "None", ",", "clicks", "=", "1", ",", "interval", "=", "0.0", ",", "button", "=", "'left'", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", ...
Performs pressing a mouse button down and then immediately releasing it. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the screen. ...
[ "Performs", "pressing", "a", "mouse", "button", "down", "and", "then", "immediately", "releasing", "it", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L377-L430
train
asweigart/pyautogui
pyautogui/__init__.py
rightClick
def rightClick(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Performs a right mouse button click. This is a wrapper function for click('right', x, y). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, ...
python
def rightClick(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Performs a right mouse button click. This is a wrapper function for click('right', x, y). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, ...
[ "def", "rightClick", "(", "x", "=", "None", ",", "y", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "click", "(", "x", ",", "y",...
Performs a right mouse button click. This is a wrapper function for click('right', x, y). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge o...
[ "Performs", "a", "right", "mouse", "button", "click", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L432-L457
train
asweigart/pyautogui
pyautogui/__init__.py
doubleClick
def doubleClick(x=None, y=None, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse positi...
python
def doubleClick(x=None, y=None, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse positi...
[ "def", "doubleClick", "(", "x", "=", "None", ",", "y", "=", "None", ",", "interval", "=", "0.0", ",", "button", "=", "'left'", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", "...
Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge o...
[ "Performs", "a", "double", "click", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L488-L530
train
asweigart/pyautogui
pyautogui/__init__.py
scroll
def scroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs a scroll of the mouse scroll wheel. Whether this is a vertical or horizontal scroll depends on the underlying operating system. The x and y parameters detail where the mouse event happens. If None, the current mouse position ...
python
def scroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs a scroll of the mouse scroll wheel. Whether this is a vertical or horizontal scroll depends on the underlying operating system. The x and y parameters detail where the mouse event happens. If None, the current mouse position ...
[ "def", "scroll", "(", "clicks", ",", "x", "=", "None", ",", "y", "=", "None", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "if", "type", "(", "x", ")", "in", "(", "tuple", ",", "list", ")", ":", ...
Performs a scroll of the mouse scroll wheel. Whether this is a vertical or horizontal scroll depends on the underlying operating system. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the bo...
[ "Performs", "a", "scroll", "of", "the", "mouse", "scroll", "wheel", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L577-L605
train
asweigart/pyautogui
pyautogui/__init__.py
hscroll
def hscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly horizontal scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is ...
python
def hscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly horizontal scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is ...
[ "def", "hscroll", "(", "clicks", ",", "x", "=", "None", ",", "y", "=", "None", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "if", "type", "(", "x", ")", "in", "(", "tuple", ",", "list", ")", ":", ...
Performs an explicitly horizontal scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the bounda...
[ "Performs", "an", "explicitly", "horizontal", "scroll", "of", "the", "mouse", "scroll", "wheel", "if", "this", "is", "supported", "by", "the", "operating", "system", ".", "(", "Currently", "just", "Linux", ".", ")" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L608-L634
train
asweigart/pyautogui
pyautogui/__init__.py
vscroll
def vscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly vertical scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is us...
python
def vscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly vertical scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is us...
[ "def", "vscroll", "(", "clicks", ",", "x", "=", "None", ",", "y", "=", "None", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "if", "type", "(", "x", ")", "in", "(", "tuple", ",", "list", ")", ":", ...
Performs an explicitly vertical scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundari...
[ "Performs", "an", "explicitly", "vertical", "scroll", "of", "the", "mouse", "scroll", "wheel", "if", "this", "is", "supported", "by", "the", "operating", "system", ".", "(", "Currently", "just", "Linux", ".", ")" ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L637-L662
train
asweigart/pyautogui
pyautogui/__init__.py
moveTo
def moveTo(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries ...
python
def moveTo(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries ...
[ "def", "moveTo", "(", "x", "=", "None", ",", "y", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "x", ",", "y", "=", "_unpackXY",...
Moves the mouse cursor to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the screen. Args: x (int, flo...
[ "Moves", "the", "mouse", "cursor", "to", "a", "point", "on", "the", "screen", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L665-L695
train
asweigart/pyautogui
pyautogui/__init__.py
moveRel
def moveRel(xOffset=None, yOffset=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value,...
python
def moveRel(xOffset=None, yOffset=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value,...
[ "def", "moveRel", "(", "xOffset", "=", "None", ",", "yOffset", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "xOffset", ",", "yOffse...
Moves the mouse cursor to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the ...
[ "Moves", "the", "mouse", "cursor", "to", "a", "point", "on", "the", "screen", "relative", "to", "its", "current", "position", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L698-L729
train
asweigart/pyautogui
pyautogui/__init__.py
dragTo
def dragTo(x=None, y=None, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse posit...
python
def dragTo(x=None, y=None, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse posit...
[ "def", "dragTo", "(", "x", "=", "None", ",", "y", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "button", "=", "'left'", ",", "pause", "=", "None", ",", "_pause", "=", "True", ",", "mouseDownUp", "=", "True", ")", ":...
Performs a mouse drag (mouse movement while a button is held down) to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge...
[ "Performs", "a", "mouse", "drag", "(", "mouse", "movement", "while", "a", "button", "is", "held", "down", ")", "to", "a", "point", "on", "the", "screen", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L735-L775
train
asweigart/pyautogui
pyautogui/__init__.py
dragRel
def dragRel(xOffset=0, yOffset=0, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happ...
python
def dragRel(xOffset=0, yOffset=0, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happ...
[ "def", "dragRel", "(", "xOffset", "=", "0", ",", "yOffset", "=", "0", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "button", "=", "'left'", ",", "pause", "=", "None", ",", "_pause", "=", "True", ",", "mouseDownUp", "=", "True", ")...
Performs a mouse drag (mouse movement while a button is held down) to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the...
[ "Performs", "a", "mouse", "drag", "(", "mouse", "movement", "while", "a", "button", "is", "held", "down", ")", "to", "a", "point", "on", "the", "screen", "relative", "to", "its", "current", "position", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L778-L827
train
asweigart/pyautogui
pyautogui/__init__.py
_mouseMoveDrag
def _mouseMoveDrag(moveOrDrag, x, y, xOffset, yOffset, duration, tween=linear, button=None): """Handles the actual move or drag event, since different platforms implement them differently. On Windows & Linux, a drag is a normal mouse move while a mouse button is held down. On OS X, a distinct "drag" ev...
python
def _mouseMoveDrag(moveOrDrag, x, y, xOffset, yOffset, duration, tween=linear, button=None): """Handles the actual move or drag event, since different platforms implement them differently. On Windows & Linux, a drag is a normal mouse move while a mouse button is held down. On OS X, a distinct "drag" ev...
[ "def", "_mouseMoveDrag", "(", "moveOrDrag", ",", "x", ",", "y", ",", "xOffset", ",", "yOffset", ",", "duration", ",", "tween", "=", "linear", ",", "button", "=", "None", ")", ":", "# The move and drag code is similar, but OS X requires a special drag event instead of ...
Handles the actual move or drag event, since different platforms implement them differently. On Windows & Linux, a drag is a normal mouse move while a mouse button is held down. On OS X, a distinct "drag" event must be used instead. The code for moving and dragging the mouse is similar, so this functi...
[ "Handles", "the", "actual", "move", "or", "drag", "event", "since", "different", "platforms", "implement", "them", "differently", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L833-L929
train
asweigart/pyautogui
pyautogui/__init__.py
keyDown
def keyDown(key, pause=None, _pause=True): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The...
python
def keyDown(key, pause=None, _pause=True): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The...
[ "def", "keyDown", "(", "key", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "if", "len", "(", "key", ")", ">", "1", ":", "key", "=", "key", ".", "lower", "(", ")", "_failSafeCheck", "(", ")", "platformModule", ".", "_keyDown", ...
Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down. The valid names are liste...
[ "Performs", "a", "keyboard", "key", "press", "without", "the", "release", ".", "This", "will", "put", "that", "key", "in", "a", "held", "down", "state", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L955-L975
train
asweigart/pyautogui
pyautogui/__init__.py
keyUp
def keyUp(key, pause=None, _pause=True): """Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in KEYBOARD_KEYS. Returns: None """ if len(key) > 1: key = key.lower() _failSafeChe...
python
def keyUp(key, pause=None, _pause=True): """Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in KEYBOARD_KEYS. Returns: None """ if len(key) > 1: key = key.lower() _failSafeChe...
[ "def", "keyUp", "(", "key", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "if", "len", "(", "key", ")", ">", "1", ":", "key", "=", "key", ".", "lower", "(", ")", "_failSafeCheck", "(", ")", "platformModule", ".", "_keyUp", "(",...
Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in KEYBOARD_KEYS. Returns: None
[ "Performs", "a", "keyboard", "key", "release", "(", "without", "the", "press", "down", "beforehand", ")", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L977-L993
train
asweigart/pyautogui
pyautogui/__init__.py
press
def press(keys, presses=1, interval=0.0, pause=None, _pause=True): """Performs a keyboard key press down, followed by a release. Args: key (str, list): The key to be pressed. The valid names are listed in KEYBOARD_KEYS. Can also be a list of such strings. presses (integer, optiional): the num...
python
def press(keys, presses=1, interval=0.0, pause=None, _pause=True): """Performs a keyboard key press down, followed by a release. Args: key (str, list): The key to be pressed. The valid names are listed in KEYBOARD_KEYS. Can also be a list of such strings. presses (integer, optiional): the num...
[ "def", "press", "(", "keys", ",", "presses", "=", "1", ",", "interval", "=", "0.0", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "if", "type", "(", "keys", ")", "==", "str", ":", "keys", "=", "[", "keys", "]", "# put string in...
Performs a keyboard key press down, followed by a release. Args: key (str, list): The key to be pressed. The valid names are listed in KEYBOARD_KEYS. Can also be a list of such strings. presses (integer, optiional): the number of press repetition 1 by default, for just one press inter...
[ "Performs", "a", "keyboard", "key", "press", "down", "followed", "by", "a", "release", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L995-L1027
train
asweigart/pyautogui
pyautogui/__init__.py
typewrite
def typewrite(message, interval=0.0, pause=None, _pause=True): """Performs a keyboard key press down, followed by a release, for each of the characters in message. The message argument can also be list of strings, in which case any valid keyboard name can be used. Since this performs a sequence of...
python
def typewrite(message, interval=0.0, pause=None, _pause=True): """Performs a keyboard key press down, followed by a release, for each of the characters in message. The message argument can also be list of strings, in which case any valid keyboard name can be used. Since this performs a sequence of...
[ "def", "typewrite", "(", "message", ",", "interval", "=", "0.0", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "interval", "=", "float", "(", "interval", ")", "_failSafeCheck", "(", ")", "for", "c", "in", "message", ":", "if", "len...
Performs a keyboard key press down, followed by a release, for each of the characters in message. The message argument can also be list of strings, in which case any valid keyboard name can be used. Since this performs a sequence of keyboard presses and does not hold down keys, it cannot be used t...
[ "Performs", "a", "keyboard", "key", "press", "down", "followed", "by", "a", "release", "for", "each", "of", "the", "characters", "in", "message", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L1029-L1061
train
asweigart/pyautogui
pyautogui/__init__.py
hotkey
def hotkey(*args, **kwargs): """Performs key down presses on the arguments passed in order, then performs key releases in reverse order. The effect is that calling hotkey('ctrl', 'shift', 'c') would perform a "Ctrl-Shift-C" hotkey/keyboard shortcut press. Args: key(s) (str): The series of ke...
python
def hotkey(*args, **kwargs): """Performs key down presses on the arguments passed in order, then performs key releases in reverse order. The effect is that calling hotkey('ctrl', 'shift', 'c') would perform a "Ctrl-Shift-C" hotkey/keyboard shortcut press. Args: key(s) (str): The series of ke...
[ "def", "hotkey", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "interval", "=", "float", "(", "kwargs", ".", "get", "(", "'interval'", ",", "0.0", ")", ")", "_failSafeCheck", "(", ")", "for", "c", "in", "args", ":", "if", "len", "(", "c", ...
Performs key down presses on the arguments passed in order, then performs key releases in reverse order. The effect is that calling hotkey('ctrl', 'shift', 'c') would perform a "Ctrl-Shift-C" hotkey/keyboard shortcut press. Args: key(s) (str): The series of keys to press, in order. This can also...
[ "Performs", "key", "down", "presses", "on", "the", "arguments", "passed", "in", "order", "then", "performs", "key", "releases", "in", "reverse", "order", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L1067-L1098
train
asweigart/pyautogui
pyautogui/__init__.py
displayMousePosition
def displayMousePosition(xOffset=0, yOffset=0): """This function is meant to be run from the command line. It will automatically display the location and RGB of the mouse cursor.""" print('Press Ctrl-C to quit.') if xOffset != 0 or yOffset != 0: print('xOffset: %s yOffset: %s' % (xOffset, yOffse...
python
def displayMousePosition(xOffset=0, yOffset=0): """This function is meant to be run from the command line. It will automatically display the location and RGB of the mouse cursor.""" print('Press Ctrl-C to quit.') if xOffset != 0 or yOffset != 0: print('xOffset: %s yOffset: %s' % (xOffset, yOffse...
[ "def", "displayMousePosition", "(", "xOffset", "=", "0", ",", "yOffset", "=", "0", ")", ":", "print", "(", "'Press Ctrl-C to quit.'", ")", "if", "xOffset", "!=", "0", "or", "yOffset", "!=", "0", ":", "print", "(", "'xOffset: %s yOffset: %s'", "%", "(", "xO...
This function is meant to be run from the command line. It will automatically display the location and RGB of the mouse cursor.
[ "This", "function", "is", "meant", "to", "be", "run", "from", "the", "command", "line", ".", "It", "will", "automatically", "display", "the", "location", "and", "RGB", "of", "the", "mouse", "cursor", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L1125-L1149
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
_keyDown
def _keyDown(key): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down....
python
def _keyDown(key): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down....
[ "def", "_keyDown", "(", "key", ")", ":", "if", "key", "not", "in", "keyboardMapping", "or", "keyboardMapping", "[", "key", "]", "is", "None", ":", "return", "needsShift", "=", "pyautogui", ".", "isShiftCharacter", "(", "key", ")", "\"\"\"\n # OLD CODE: The ...
Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down. The valid names are liste...
[ "Performs", "a", "keyboard", "key", "press", "without", "the", "release", ".", "This", "will", "put", "that", "key", "in", "a", "held", "down", "state", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L267-L309
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
_position
def _position(): """Returns the current xy coordinates of the mouse cursor as a two-integer tuple by calling the GetCursorPos() win32 function. Returns: (x, y) tuple of the current xy coordinates of the mouse cursor. """ cursor = POINT() ctypes.windll.user32.GetCursorPos(ctypes.byref(cur...
python
def _position(): """Returns the current xy coordinates of the mouse cursor as a two-integer tuple by calling the GetCursorPos() win32 function. Returns: (x, y) tuple of the current xy coordinates of the mouse cursor. """ cursor = POINT() ctypes.windll.user32.GetCursorPos(ctypes.byref(cur...
[ "def", "_position", "(", ")", ":", "cursor", "=", "POINT", "(", ")", "ctypes", ".", "windll", ".", "user32", ".", "GetCursorPos", "(", "ctypes", ".", "byref", "(", "cursor", ")", ")", "return", "(", "cursor", ".", "x", ",", "cursor", ".", "y", ")" ...
Returns the current xy coordinates of the mouse cursor as a two-integer tuple by calling the GetCursorPos() win32 function. Returns: (x, y) tuple of the current xy coordinates of the mouse cursor.
[ "Returns", "the", "current", "xy", "coordinates", "of", "the", "mouse", "cursor", "as", "a", "two", "-", "integer", "tuple", "by", "calling", "the", "GetCursorPos", "()", "win32", "function", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L352-L362
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
_mouseDown
def _mouseDown(x, y, button): """Send the mouse down event to Windows by calling the mouse_event() win32 function. Args: x (int): The x position of the mouse event. y (int): The y position of the mouse event. button (str): The mouse button, either 'left', 'middle', or 'right' Returns...
python
def _mouseDown(x, y, button): """Send the mouse down event to Windows by calling the mouse_event() win32 function. Args: x (int): The x position of the mouse event. y (int): The y position of the mouse event. button (str): The mouse button, either 'left', 'middle', or 'right' Returns...
[ "def", "_mouseDown", "(", "x", ",", "y", ",", "button", ")", ":", "if", "button", "==", "'left'", ":", "try", ":", "_sendMouseEvent", "(", "MOUSEEVENTF_LEFTDOWN", ",", "x", ",", "y", ")", "except", "(", "PermissionError", ",", "OSError", ")", ":", "# T...
Send the mouse down event to Windows by calling the mouse_event() win32 function. Args: x (int): The x position of the mouse event. y (int): The y position of the mouse event. button (str): The mouse button, either 'left', 'middle', or 'right' Returns: None
[ "Send", "the", "mouse", "down", "event", "to", "Windows", "by", "calling", "the", "mouse_event", "()", "win32", "function", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L389-L417
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
_mouseUp
def _mouseUp(x, y, button): """Send the mouse up event to Windows by calling the mouse_event() win32 function. Args: x (int): The x position of the mouse event. y (int): The y position of the mouse event. button (str): The mouse button, either 'left', 'middle', or 'right' Returns: ...
python
def _mouseUp(x, y, button): """Send the mouse up event to Windows by calling the mouse_event() win32 function. Args: x (int): The x position of the mouse event. y (int): The y position of the mouse event. button (str): The mouse button, either 'left', 'middle', or 'right' Returns: ...
[ "def", "_mouseUp", "(", "x", ",", "y", ",", "button", ")", ":", "if", "button", "==", "'left'", ":", "try", ":", "_sendMouseEvent", "(", "MOUSEEVENTF_LEFTUP", ",", "x", ",", "y", ")", "except", "(", "PermissionError", ",", "OSError", ")", ":", "# TODO:...
Send the mouse up event to Windows by calling the mouse_event() win32 function. Args: x (int): The x position of the mouse event. y (int): The y position of the mouse event. button (str): The mouse button, either 'left', 'middle', or 'right' Returns: None
[ "Send", "the", "mouse", "up", "event", "to", "Windows", "by", "calling", "the", "mouse_event", "()", "win32", "function", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L420-L448
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
_click
def _click(x, y, button): """Send the mouse click event to Windows by calling the mouse_event() win32 function. Args: button (str): The mouse button, either 'left', 'middle', or 'right' x (int): The x position of the mouse event. y (int): The y position of the mouse event. Returns: ...
python
def _click(x, y, button): """Send the mouse click event to Windows by calling the mouse_event() win32 function. Args: button (str): The mouse button, either 'left', 'middle', or 'right' x (int): The x position of the mouse event. y (int): The y position of the mouse event. Returns: ...
[ "def", "_click", "(", "x", ",", "y", ",", "button", ")", ":", "if", "button", "==", "'left'", ":", "try", ":", "_sendMouseEvent", "(", "MOUSEEVENTF_LEFTCLICK", ",", "x", ",", "y", ")", "except", "(", "PermissionError", ",", "OSError", ")", ":", "# TODO...
Send the mouse click event to Windows by calling the mouse_event() win32 function. Args: button (str): The mouse button, either 'left', 'middle', or 'right' x (int): The x position of the mouse event. y (int): The y position of the mouse event. Returns: None
[ "Send", "the", "mouse", "click", "event", "to", "Windows", "by", "calling", "the", "mouse_event", "()", "win32", "function", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L451-L479
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
_sendMouseEvent
def _sendMouseEvent(ev, x, y, dwData=0): """The helper function that actually makes the call to the mouse_event() win32 function. Args: ev (int): The win32 code for the mouse event. Use one of the MOUSEEVENTF_* constants for this argument. x (int): The x position of the mouse event. ...
python
def _sendMouseEvent(ev, x, y, dwData=0): """The helper function that actually makes the call to the mouse_event() win32 function. Args: ev (int): The win32 code for the mouse event. Use one of the MOUSEEVENTF_* constants for this argument. x (int): The x position of the mouse event. ...
[ "def", "_sendMouseEvent", "(", "ev", ",", "x", ",", "y", ",", "dwData", "=", "0", ")", ":", "assert", "x", "!=", "None", "and", "y", "!=", "None", ",", "'x and y cannot be set to None'", "# TODO: ARG! For some reason, SendInput isn't working for mouse events. I'm swit...
The helper function that actually makes the call to the mouse_event() win32 function. Args: ev (int): The win32 code for the mouse event. Use one of the MOUSEEVENTF_* constants for this argument. x (int): The x position of the mouse event. y (int): The y position of the mouse event. ...
[ "The", "helper", "function", "that", "actually", "makes", "the", "call", "to", "the", "mouse_event", "()", "win32", "function", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L482-L513
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
_scroll
def _scroll(clicks, x=None, y=None): """Send the mouse vertical scroll event to Windows by calling the mouse_event() win32 function. Args: clicks (int): The amount of scrolling to do. A positive value is the mouse wheel moving forward (scrolling up), a negative value is backwards (down). ...
python
def _scroll(clicks, x=None, y=None): """Send the mouse vertical scroll event to Windows by calling the mouse_event() win32 function. Args: clicks (int): The amount of scrolling to do. A positive value is the mouse wheel moving forward (scrolling up), a negative value is backwards (down). ...
[ "def", "_scroll", "(", "clicks", ",", "x", "=", "None", ",", "y", "=", "None", ")", ":", "startx", ",", "starty", "=", "_position", "(", ")", "width", ",", "height", "=", "_size", "(", ")", "if", "x", "is", "None", ":", "x", "=", "startx", "els...
Send the mouse vertical scroll event to Windows by calling the mouse_event() win32 function. Args: clicks (int): The amount of scrolling to do. A positive value is the mouse wheel moving forward (scrolling up), a negative value is backwards (down). x (int): The x position of the mouse event. ...
[ "Send", "the", "mouse", "vertical", "scroll", "event", "to", "Windows", "by", "calling", "the", "mouse_event", "()", "win32", "function", "." ]
77524bd47334a89024013fd48e05151c3ac9289a
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L520-L554
train
burnash/gspread
gspread/__init__.py
authorize
def authorize(credentials, client_class=Client): """Login to Google API using OAuth2 credentials. This is a shortcut function which instantiates :class:`gspread.client.Client` and performs login right away. :returns: :class:`gspread.Client` instance. """ client = client_class(auth=credentia...
python
def authorize(credentials, client_class=Client): """Login to Google API using OAuth2 credentials. This is a shortcut function which instantiates :class:`gspread.client.Client` and performs login right away. :returns: :class:`gspread.Client` instance. """ client = client_class(auth=credentia...
[ "def", "authorize", "(", "credentials", ",", "client_class", "=", "Client", ")", ":", "client", "=", "client_class", "(", "auth", "=", "credentials", ")", "client", ".", "login", "(", ")", "return", "client" ]
Login to Google API using OAuth2 credentials. This is a shortcut function which instantiates :class:`gspread.client.Client` and performs login right away. :returns: :class:`gspread.Client` instance.
[ "Login", "to", "Google", "API", "using", "OAuth2", "credentials", ".", "This", "is", "a", "shortcut", "function", "which", "instantiates", ":", "class", ":", "gspread", ".", "client", ".", "Client", "and", "performs", "login", "right", "away", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/__init__.py#L29-L39
train
burnash/gspread
gspread/models.py
Spreadsheet.title
def title(self): """Spreadsheet title.""" try: return self._properties['title'] except KeyError: metadata = self.fetch_sheet_metadata() self._properties.update(metadata['properties']) return self._properties['title']
python
def title(self): """Spreadsheet title.""" try: return self._properties['title'] except KeyError: metadata = self.fetch_sheet_metadata() self._properties.update(metadata['properties']) return self._properties['title']
[ "def", "title", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_properties", "[", "'title'", "]", "except", "KeyError", ":", "metadata", "=", "self", ".", "fetch_sheet_metadata", "(", ")", "self", ".", "_properties", ".", "update", "(", "meta...
Spreadsheet title.
[ "Spreadsheet", "title", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L50-L57
train
burnash/gspread
gspread/models.py
Spreadsheet.batch_update
def batch_update(self, body): """Lower-level method that directly calls `spreadsheets.batchUpdate <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate>`_. :param dict body: `Request body <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate...
python
def batch_update(self, body): """Lower-level method that directly calls `spreadsheets.batchUpdate <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate>`_. :param dict body: `Request body <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate...
[ "def", "batch_update", "(", "self", ",", "body", ")", ":", "r", "=", "self", ".", "client", ".", "request", "(", "'post'", ",", "SPREADSHEET_BATCH_UPDATE_URL", "%", "self", ".", "id", ",", "json", "=", "body", ")", "return", "r", ".", "json", "(", ")...
Lower-level method that directly calls `spreadsheets.batchUpdate <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate>`_. :param dict body: `Request body <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate#request-body>`_. :returns: `Resp...
[ "Lower", "-", "level", "method", "that", "directly", "calls", "spreadsheets", ".", "batchUpdate", "<https", ":", "//", "developers", ".", "google", ".", "com", "/", "sheets", "/", "api", "/", "reference", "/", "rest", "/", "v4", "/", "spreadsheets", "/", ...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L87-L103
train
burnash/gspread
gspread/models.py
Spreadsheet.values_append
def values_append(self, range, params, body): """Lower-level method that directly calls `spreadsheets.values.append <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_...
python
def values_append(self, range, params, body): """Lower-level method that directly calls `spreadsheets.values.append <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_...
[ "def", "values_append", "(", "self", ",", "range", ",", "params", ",", "body", ")", ":", "url", "=", "SPREADSHEET_VALUES_APPEND_URL", "%", "(", "self", ".", "id", ",", "quote", "(", "range", ")", ")", "r", "=", "self", ".", "client", ".", "request", ...
Lower-level method that directly calls `spreadsheets.values.append <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of a range to searc...
[ "Lower", "-", "level", "method", "that", "directly", "calls", "spreadsheets", ".", "values", ".", "append", "<https", ":", "//", "developers", ".", "google", ".", "com", "/", "sheets", "/", "api", "/", "reference", "/", "rest", "/", "v4", "/", "spreadshe...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L105-L120
train
burnash/gspread
gspread/models.py
Spreadsheet.values_clear
def values_clear(self, range): """Lower-level method that directly calls `spreadsheets.values.clear <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of th...
python
def values_clear(self, range): """Lower-level method that directly calls `spreadsheets.values.clear <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of th...
[ "def", "values_clear", "(", "self", ",", "range", ")", ":", "url", "=", "SPREADSHEET_VALUES_CLEAR_URL", "%", "(", "self", ".", "id", ",", "quote", "(", "range", ")", ")", "r", "=", "self", ".", "client", ".", "request", "(", "'post'", ",", "url", ")"...
Lower-level method that directly calls `spreadsheets.values.clear <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of the values to clear. :returns: `Resp...
[ "Lower", "-", "level", "method", "that", "directly", "calls", "spreadsheets", ".", "values", ".", "clear", "<https", ":", "//", "developers", ".", "google", ".", "com", "/", "sheets", "/", "api", "/", "reference", "/", "rest", "/", "v4", "/", "spreadshee...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L122-L134
train
burnash/gspread
gspread/models.py
Spreadsheet.values_get
def values_get(self, range, params=None): """Lower-level method that directly calls `spreadsheets.values.get <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`...
python
def values_get(self, range, params=None): """Lower-level method that directly calls `spreadsheets.values.get <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`...
[ "def", "values_get", "(", "self", ",", "range", ",", "params", "=", "None", ")", ":", "url", "=", "SPREADSHEET_VALUES_URL", "%", "(", "self", ".", "id", ",", "quote", "(", "range", ")", ")", "r", "=", "self", ".", "client", ".", "request", "(", "'g...
Lower-level method that directly calls `spreadsheets.values.get <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of the values to retrieve. :param dict para...
[ "Lower", "-", "level", "method", "that", "directly", "calls", "spreadsheets", ".", "values", ".", "get", "<https", ":", "//", "developers", ".", "google", ".", "com", "/", "sheets", "/", "api", "/", "reference", "/", "rest", "/", "v4", "/", "spreadsheets...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L136-L149
train
burnash/gspread
gspread/models.py
Spreadsheet.values_update
def values_update(self, range, params=None, body=None): """Lower-level method that directly calls `spreadsheets.values.update <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/co...
python
def values_update(self, range, params=None, body=None): """Lower-level method that directly calls `spreadsheets.values.update <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/co...
[ "def", "values_update", "(", "self", ",", "range", ",", "params", "=", "None", ",", "body", "=", "None", ")", ":", "url", "=", "SPREADSHEET_VALUES_URL", "%", "(", "self", ".", "id", ",", "quote", "(", "range", ")", ")", "r", "=", "self", ".", "clie...
Lower-level method that directly calls `spreadsheets.values.update <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update>`_. :param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of the values to update. :param dict ...
[ "Lower", "-", "level", "method", "that", "directly", "calls", "spreadsheets", ".", "values", ".", "update", "<https", ":", "//", "developers", ".", "google", ".", "com", "/", "sheets", "/", "api", "/", "reference", "/", "rest", "/", "v4", "/", "spreadshe...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L151-L177
train
burnash/gspread
gspread/models.py
Spreadsheet.get_worksheet
def get_worksheet(self, index): """Returns a worksheet with specified `index`. :param index: An index of a worksheet. Indexes start from zero. :type index: int :returns: an instance of :class:`gsperad.models.Worksheet` or `None` if the worksheet is not found. ...
python
def get_worksheet(self, index): """Returns a worksheet with specified `index`. :param index: An index of a worksheet. Indexes start from zero. :type index: int :returns: an instance of :class:`gsperad.models.Worksheet` or `None` if the worksheet is not found. ...
[ "def", "get_worksheet", "(", "self", ",", "index", ")", ":", "sheet_data", "=", "self", ".", "fetch_sheet_metadata", "(", ")", "try", ":", "properties", "=", "sheet_data", "[", "'sheets'", "]", "[", "index", "]", "[", "'properties'", "]", "return", "Worksh...
Returns a worksheet with specified `index`. :param index: An index of a worksheet. Indexes start from zero. :type index: int :returns: an instance of :class:`gsperad.models.Worksheet` or `None` if the worksheet is not found. Example. To get first worksheet of a sprea...
[ "Returns", "a", "worksheet", "with", "specified", "index", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L188-L209
train
burnash/gspread
gspread/models.py
Spreadsheet.worksheets
def worksheets(self): """Returns a list of all :class:`worksheets <gsperad.models.Worksheet>` in a spreadsheet. """ sheet_data = self.fetch_sheet_metadata() return [Worksheet(self, x['properties']) for x in sheet_data['sheets']]
python
def worksheets(self): """Returns a list of all :class:`worksheets <gsperad.models.Worksheet>` in a spreadsheet. """ sheet_data = self.fetch_sheet_metadata() return [Worksheet(self, x['properties']) for x in sheet_data['sheets']]
[ "def", "worksheets", "(", "self", ")", ":", "sheet_data", "=", "self", ".", "fetch_sheet_metadata", "(", ")", "return", "[", "Worksheet", "(", "self", ",", "x", "[", "'properties'", "]", ")", "for", "x", "in", "sheet_data", "[", "'sheets'", "]", "]" ]
Returns a list of all :class:`worksheets <gsperad.models.Worksheet>` in a spreadsheet.
[ "Returns", "a", "list", "of", "all", ":", "class", ":", "worksheets", "<gsperad", ".", "models", ".", "Worksheet", ">", "in", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L211-L217
train
burnash/gspread
gspread/models.py
Spreadsheet.worksheet
def worksheet(self, title): """Returns a worksheet with specified `title`. :param title: A title of a worksheet. If there're multiple worksheets with the same title, first one will be returned. :type title: int :returns: an instance of :class...
python
def worksheet(self, title): """Returns a worksheet with specified `title`. :param title: A title of a worksheet. If there're multiple worksheets with the same title, first one will be returned. :type title: int :returns: an instance of :class...
[ "def", "worksheet", "(", "self", ",", "title", ")", ":", "sheet_data", "=", "self", ".", "fetch_sheet_metadata", "(", ")", "try", ":", "item", "=", "finditem", "(", "lambda", "x", ":", "x", "[", "'properties'", "]", "[", "'title'", "]", "==", "title", ...
Returns a worksheet with specified `title`. :param title: A title of a worksheet. If there're multiple worksheets with the same title, first one will be returned. :type title: int :returns: an instance of :class:`gsperad.models.Worksheet`. E...
[ "Returns", "a", "worksheet", "with", "specified", "title", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L219-L243
train
burnash/gspread
gspread/models.py
Spreadsheet.add_worksheet
def add_worksheet(self, title, rows, cols): """Adds a new worksheet to a spreadsheet. :param title: A title of a new worksheet. :type title: str :param rows: Number of rows. :type rows: int :param cols: Number of columns. :type cols: int :returns: a newl...
python
def add_worksheet(self, title, rows, cols): """Adds a new worksheet to a spreadsheet. :param title: A title of a new worksheet. :type title: str :param rows: Number of rows. :type rows: int :param cols: Number of columns. :type cols: int :returns: a newl...
[ "def", "add_worksheet", "(", "self", ",", "title", ",", "rows", ",", "cols", ")", ":", "body", "=", "{", "'requests'", ":", "[", "{", "'addSheet'", ":", "{", "'properties'", ":", "{", "'title'", ":", "title", ",", "'sheetType'", ":", "'GRID'", ",", "...
Adds a new worksheet to a spreadsheet. :param title: A title of a new worksheet. :type title: str :param rows: Number of rows. :type rows: int :param cols: Number of columns. :type cols: int :returns: a newly created :class:`worksheets <gsperad.models.Worksheet>...
[ "Adds", "a", "new", "worksheet", "to", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L245-L278
train
burnash/gspread
gspread/models.py
Spreadsheet.duplicate_sheet
def duplicate_sheet( self, source_sheet_id, insert_sheet_index=None, new_sheet_id=None, new_sheet_name=None ): """Duplicates the contents of a sheet. :param int source_sheet_id: The sheet ID to duplicate. :param int insert_sheet_index: (optional) The ...
python
def duplicate_sheet( self, source_sheet_id, insert_sheet_index=None, new_sheet_id=None, new_sheet_name=None ): """Duplicates the contents of a sheet. :param int source_sheet_id: The sheet ID to duplicate. :param int insert_sheet_index: (optional) The ...
[ "def", "duplicate_sheet", "(", "self", ",", "source_sheet_id", ",", "insert_sheet_index", "=", "None", ",", "new_sheet_id", "=", "None", ",", "new_sheet_name", "=", "None", ")", ":", "body", "=", "{", "'requests'", ":", "[", "{", "'duplicateSheet'", ":", "{"...
Duplicates the contents of a sheet. :param int source_sheet_id: The sheet ID to duplicate. :param int insert_sheet_index: (optional) The zero-based index where the new sheet should be inserted. The index of all sheets after t...
[ "Duplicates", "the", "contents", "of", "a", "sheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L280-L323
train
burnash/gspread
gspread/models.py
Spreadsheet.share
def share(self, value, perm_type, role, notify=True, email_message=None, with_link=False): """Share the spreadsheet with other accounts. :param value: user or group e-mail address, domain name or None for 'default' type. :type value: str, None :param perm_type: The...
python
def share(self, value, perm_type, role, notify=True, email_message=None, with_link=False): """Share the spreadsheet with other accounts. :param value: user or group e-mail address, domain name or None for 'default' type. :type value: str, None :param perm_type: The...
[ "def", "share", "(", "self", ",", "value", ",", "perm_type", ",", "role", ",", "notify", "=", "True", ",", "email_message", "=", "None", ",", "with_link", "=", "False", ")", ":", "self", ".", "client", ".", "insert_permission", "(", "self", ".", "id", ...
Share the spreadsheet with other accounts. :param value: user or group e-mail address, domain name or None for 'default' type. :type value: str, None :param perm_type: The account type. Allowed values are: ``user``, ``group``, ``domain``, ``an...
[ "Share", "the", "spreadsheet", "with", "other", "accounts", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L340-L378
train
burnash/gspread
gspread/models.py
Spreadsheet.remove_permissions
def remove_permissions(self, value, role='any'): """Remove permissions from a user or domain. :param value: User or domain to remove permissions from :type value: str :param role: (optional) Permission to remove. Defaults to all permissions. :type role: str ...
python
def remove_permissions(self, value, role='any'): """Remove permissions from a user or domain. :param value: User or domain to remove permissions from :type value: str :param role: (optional) Permission to remove. Defaults to all permissions. :type role: str ...
[ "def", "remove_permissions", "(", "self", ",", "value", ",", "role", "=", "'any'", ")", ":", "permission_list", "=", "self", ".", "client", ".", "list_permissions", "(", "self", ".", "id", ")", "key", "=", "'emailAddress'", "if", "'@'", "in", "value", "e...
Remove permissions from a user or domain. :param value: User or domain to remove permissions from :type value: str :param role: (optional) Permission to remove. Defaults to all permissions. :type role: str Example:: # Remove Otto's write permis...
[ "Remove", "permissions", "from", "a", "user", "or", "domain", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L385-L414
train
burnash/gspread
gspread/models.py
Worksheet.acell
def acell(self, label, value_render_option='FORMATTED_VALUE'): """Returns an instance of a :class:`gspread.models.Cell`. :param label: Cell label in A1 notation Letter case is ignored. :type label: str :param value_render_option: (optional) Determines how values sh...
python
def acell(self, label, value_render_option='FORMATTED_VALUE'): """Returns an instance of a :class:`gspread.models.Cell`. :param label: Cell label in A1 notation Letter case is ignored. :type label: str :param value_render_option: (optional) Determines how values sh...
[ "def", "acell", "(", "self", ",", "label", ",", "value_render_option", "=", "'FORMATTED_VALUE'", ")", ":", "return", "self", ".", "cell", "(", "*", "(", "a1_to_rowcol", "(", "label", ")", ")", ",", "value_render_option", "=", "value_render_option", ")" ]
Returns an instance of a :class:`gspread.models.Cell`. :param label: Cell label in A1 notation Letter case is ignored. :type label: str :param value_render_option: (optional) Determines how values should be rendered in the the output. Se...
[ "Returns", "an", "instance", "of", "a", ":", "class", ":", "gspread", ".", "models", ".", "Cell", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L467-L490
train
burnash/gspread
gspread/models.py
Worksheet.cell
def cell(self, row, col, value_render_option='FORMATTED_VALUE'): """Returns an instance of a :class:`gspread.models.Cell` located at `row` and `col` column. :param row: Row number. :type row: int :param col: Column number. :type col: int :param value_render_optio...
python
def cell(self, row, col, value_render_option='FORMATTED_VALUE'): """Returns an instance of a :class:`gspread.models.Cell` located at `row` and `col` column. :param row: Row number. :type row: int :param col: Column number. :type col: int :param value_render_optio...
[ "def", "cell", "(", "self", ",", "row", ",", "col", ",", "value_render_option", "=", "'FORMATTED_VALUE'", ")", ":", "range_label", "=", "'%s!%s'", "%", "(", "self", ".", "title", ",", "rowcol_to_a1", "(", "row", ",", "col", ")", ")", "data", "=", "self...
Returns an instance of a :class:`gspread.models.Cell` located at `row` and `col` column. :param row: Row number. :type row: int :param col: Column number. :type col: int :param value_render_option: (optional) Determines how values should be ...
[ "Returns", "an", "instance", "of", "a", ":", "class", ":", "gspread", ".", "models", ".", "Cell", "located", "at", "row", "and", "col", "column", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L492-L525
train
burnash/gspread
gspread/models.py
Worksheet.range
def range(self, name): """Returns a list of :class:`Cell` objects from a specified range. :param name: A string with range value in A1 notation, e.g. 'A1:A5'. :type name: str Alternatively, you may specify numeric boundaries. All values index from 1 (one): :param first...
python
def range(self, name): """Returns a list of :class:`Cell` objects from a specified range. :param name: A string with range value in A1 notation, e.g. 'A1:A5'. :type name: str Alternatively, you may specify numeric boundaries. All values index from 1 (one): :param first...
[ "def", "range", "(", "self", ",", "name", ")", ":", "range_label", "=", "'%s!%s'", "%", "(", "self", ".", "title", ",", "name", ")", "data", "=", "self", ".", "spreadsheet", ".", "values_get", "(", "range_label", ")", "start", ",", "end", "=", "name"...
Returns a list of :class:`Cell` objects from a specified range. :param name: A string with range value in A1 notation, e.g. 'A1:A5'. :type name: str Alternatively, you may specify numeric boundaries. All values index from 1 (one): :param first_row: Row number :type fir...
[ "Returns", "a", "list", "of", ":", "class", ":", "Cell", "objects", "from", "a", "specified", "range", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L528-L578
train
burnash/gspread
gspread/models.py
Worksheet.get_all_values
def get_all_values(self): """Returns a list of lists containing all cells' values as strings. .. note:: Empty trailing rows and columns will not be included. """ data = self.spreadsheet.values_get(self.title) try: return fill_gaps(data['values']) ...
python
def get_all_values(self): """Returns a list of lists containing all cells' values as strings. .. note:: Empty trailing rows and columns will not be included. """ data = self.spreadsheet.values_get(self.title) try: return fill_gaps(data['values']) ...
[ "def", "get_all_values", "(", "self", ")", ":", "data", "=", "self", ".", "spreadsheet", ".", "values_get", "(", "self", ".", "title", ")", "try", ":", "return", "fill_gaps", "(", "data", "[", "'values'", "]", ")", "except", "KeyError", ":", "return", ...
Returns a list of lists containing all cells' values as strings. .. note:: Empty trailing rows and columns will not be included.
[ "Returns", "a", "list", "of", "lists", "containing", "all", "cells", "values", "as", "strings", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L580-L593
train
burnash/gspread
gspread/models.py
Worksheet.get_all_records
def get_all_records( self, empty2zero=False, head=1, default_blank="", allow_underscores_in_numeric_literals=False, ): """Returns a list of dictionaries, all of them having the contents of the spreadsheet with the head row as keys and each of these ...
python
def get_all_records( self, empty2zero=False, head=1, default_blank="", allow_underscores_in_numeric_literals=False, ): """Returns a list of dictionaries, all of them having the contents of the spreadsheet with the head row as keys and each of these ...
[ "def", "get_all_records", "(", "self", ",", "empty2zero", "=", "False", ",", "head", "=", "1", ",", "default_blank", "=", "\"\"", ",", "allow_underscores_in_numeric_literals", "=", "False", ",", ")", ":", "idx", "=", "head", "-", "1", "data", "=", "self", ...
Returns a list of dictionaries, all of them having the contents of the spreadsheet with the head row as keys and each of these dictionaries holding the contents of subsequent rows of cells as values. Cell values are numericised (strings that can be read as ints ...
[ "Returns", "a", "list", "of", "dictionaries", "all", "of", "them", "having", "the", "contents", "of", "the", "spreadsheet", "with", "the", "head", "row", "as", "keys", "and", "each", "of", "these", "dictionaries", "holding", "the", "contents", "of", "subsequ...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L595-L645
train
burnash/gspread
gspread/models.py
Worksheet.row_values
def row_values(self, row, value_render_option='FORMATTED_VALUE'): """Returns a list of all values in a `row`. Empty cells in this list will be rendered as :const:`None`. :param row: Row number. :type row: int :param value_render_option: (optional) Determines how values should b...
python
def row_values(self, row, value_render_option='FORMATTED_VALUE'): """Returns a list of all values in a `row`. Empty cells in this list will be rendered as :const:`None`. :param row: Row number. :type row: int :param value_render_option: (optional) Determines how values should b...
[ "def", "row_values", "(", "self", ",", "row", ",", "value_render_option", "=", "'FORMATTED_VALUE'", ")", ":", "range_label", "=", "'%s!A%s:%s'", "%", "(", "self", ".", "title", ",", "row", ",", "row", ")", "data", "=", "self", ".", "spreadsheet", ".", "v...
Returns a list of all values in a `row`. Empty cells in this list will be rendered as :const:`None`. :param row: Row number. :type row: int :param value_render_option: (optional) Determines how values should be rendered in the the output. See ...
[ "Returns", "a", "list", "of", "all", "values", "in", "a", "row", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L647-L673
train
burnash/gspread
gspread/models.py
Worksheet.col_values
def col_values(self, col, value_render_option='FORMATTED_VALUE'): """Returns a list of all values in column `col`. Empty cells in this list will be rendered as :const:`None`. :param col: Column number. :type col: int :param value_render_option: (optional) Determines how values ...
python
def col_values(self, col, value_render_option='FORMATTED_VALUE'): """Returns a list of all values in column `col`. Empty cells in this list will be rendered as :const:`None`. :param col: Column number. :type col: int :param value_render_option: (optional) Determines how values ...
[ "def", "col_values", "(", "self", ",", "col", ",", "value_render_option", "=", "'FORMATTED_VALUE'", ")", ":", "start_label", "=", "rowcol_to_a1", "(", "1", ",", "col", ")", "range_label", "=", "'%s!%s:%s'", "%", "(", "self", ".", "title", ",", "start_label",...
Returns a list of all values in column `col`. Empty cells in this list will be rendered as :const:`None`. :param col: Column number. :type col: int :param value_render_option: (optional) Determines how values should be rendered in the the output. See...
[ "Returns", "a", "list", "of", "all", "values", "in", "column", "col", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L675-L705
train
burnash/gspread
gspread/models.py
Worksheet.update_acell
def update_acell(self, label, value): """Updates the value of a cell. :param label: Cell label in A1 notation. Letter case is ignored. :type label: str :param value: New value. Example:: worksheet.update_acell('A1', '42') """ ...
python
def update_acell(self, label, value): """Updates the value of a cell. :param label: Cell label in A1 notation. Letter case is ignored. :type label: str :param value: New value. Example:: worksheet.update_acell('A1', '42') """ ...
[ "def", "update_acell", "(", "self", ",", "label", ",", "value", ")", ":", "return", "self", ".", "update_cell", "(", "*", "(", "a1_to_rowcol", "(", "label", ")", ")", ",", "value", "=", "value", ")" ]
Updates the value of a cell. :param label: Cell label in A1 notation. Letter case is ignored. :type label: str :param value: New value. Example:: worksheet.update_acell('A1', '42')
[ "Updates", "the", "value", "of", "a", "cell", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L707-L720
train
burnash/gspread
gspread/models.py
Worksheet.update_cell
def update_cell(self, row, col, value): """Updates the value of a cell. :param row: Row number. :type row: int :param col: Column number. :type col: int :param value: New value. Example:: worksheet.update_cell(1, 1, '42') """ range_...
python
def update_cell(self, row, col, value): """Updates the value of a cell. :param row: Row number. :type row: int :param col: Column number. :type col: int :param value: New value. Example:: worksheet.update_cell(1, 1, '42') """ range_...
[ "def", "update_cell", "(", "self", ",", "row", ",", "col", ",", "value", ")", ":", "range_label", "=", "'%s!%s'", "%", "(", "self", ".", "title", ",", "rowcol_to_a1", "(", "row", ",", "col", ")", ")", "data", "=", "self", ".", "spreadsheet", ".", "...
Updates the value of a cell. :param row: Row number. :type row: int :param col: Column number. :type col: int :param value: New value. Example:: worksheet.update_cell(1, 1, '42')
[ "Updates", "the", "value", "of", "a", "cell", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L722-L748
train
burnash/gspread
gspread/models.py
Worksheet.update_cells
def update_cells(self, cell_list, value_input_option='RAW'): """Updates many cells at once. :param cell_list: List of :class:`Cell` objects to update. :param value_input_option: (optional) Determines how input data should be interpreted. See `ValueInputOption...
python
def update_cells(self, cell_list, value_input_option='RAW'): """Updates many cells at once. :param cell_list: List of :class:`Cell` objects to update. :param value_input_option: (optional) Determines how input data should be interpreted. See `ValueInputOption...
[ "def", "update_cells", "(", "self", ",", "cell_list", ",", "value_input_option", "=", "'RAW'", ")", ":", "values_rect", "=", "cell_list_to_rect", "(", "cell_list", ")", "start", "=", "rowcol_to_a1", "(", "min", "(", "c", ".", "row", "for", "c", "in", "cell...
Updates many cells at once. :param cell_list: List of :class:`Cell` objects to update. :param value_input_option: (optional) Determines how input data should be interpreted. See `ValueInputOption`_ in the Sheets API. :type ...
[ "Updates", "many", "cells", "at", "once", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L750-L791
train
burnash/gspread
gspread/models.py
Worksheet.resize
def resize(self, rows=None, cols=None): """Resizes the worksheet. Specify one of ``rows`` or ``cols``. :param rows: (optional) New number of rows. :type rows: int :param cols: (optional) New number columns. :type cols: int """ grid_properties = {} if row...
python
def resize(self, rows=None, cols=None): """Resizes the worksheet. Specify one of ``rows`` or ``cols``. :param rows: (optional) New number of rows. :type rows: int :param cols: (optional) New number columns. :type cols: int """ grid_properties = {} if row...
[ "def", "resize", "(", "self", ",", "rows", "=", "None", ",", "cols", "=", "None", ")", ":", "grid_properties", "=", "{", "}", "if", "rows", "is", "not", "None", ":", "grid_properties", "[", "'rowCount'", "]", "=", "rows", "if", "cols", "is", "not", ...
Resizes the worksheet. Specify one of ``rows`` or ``cols``. :param rows: (optional) New number of rows. :type rows: int :param cols: (optional) New number columns. :type cols: int
[ "Resizes", "the", "worksheet", ".", "Specify", "one", "of", "rows", "or", "cols", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L793-L828
train
burnash/gspread
gspread/models.py
Worksheet.update_title
def update_title(self, title): """Renames the worksheet. :param title: A new title. :type title: str """ body = { 'requests': [{ 'updateSheetProperties': { 'properties': { 'sheetId': self.id, ...
python
def update_title(self, title): """Renames the worksheet. :param title: A new title. :type title: str """ body = { 'requests': [{ 'updateSheetProperties': { 'properties': { 'sheetId': self.id, ...
[ "def", "update_title", "(", "self", ",", "title", ")", ":", "body", "=", "{", "'requests'", ":", "[", "{", "'updateSheetProperties'", ":", "{", "'properties'", ":", "{", "'sheetId'", ":", "self", ".", "id", ",", "'title'", ":", "title", "}", ",", "'fie...
Renames the worksheet. :param title: A new title. :type title: str
[ "Renames", "the", "worksheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L830-L852
train
burnash/gspread
gspread/models.py
Worksheet.append_row
def append_row(self, values, value_input_option='RAW'): """Adds a row to the worksheet and populates it with values. Widens the worksheet if there are more values than columns. :param values: List of values for the new row. :param value_input_option: (optional) Determines how input data...
python
def append_row(self, values, value_input_option='RAW'): """Adds a row to the worksheet and populates it with values. Widens the worksheet if there are more values than columns. :param values: List of values for the new row. :param value_input_option: (optional) Determines how input data...
[ "def", "append_row", "(", "self", ",", "values", ",", "value_input_option", "=", "'RAW'", ")", ":", "params", "=", "{", "'valueInputOption'", ":", "value_input_option", "}", "body", "=", "{", "'values'", ":", "[", "values", "]", "}", "return", "self", ".",...
Adds a row to the worksheet and populates it with values. Widens the worksheet if there are more values than columns. :param values: List of values for the new row. :param value_input_option: (optional) Determines how input data should be interpreted. See `Va...
[ "Adds", "a", "row", "to", "the", "worksheet", "and", "populates", "it", "with", "values", ".", "Widens", "the", "worksheet", "if", "there", "are", "more", "values", "than", "columns", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L872-L893
train
burnash/gspread
gspread/models.py
Worksheet.insert_row
def insert_row( self, values, index=1, value_input_option='RAW' ): """Adds a row to the worksheet at the specified index and populates it with values. Widens the worksheet if there are more values than columns. :param values: List of values for the n...
python
def insert_row( self, values, index=1, value_input_option='RAW' ): """Adds a row to the worksheet at the specified index and populates it with values. Widens the worksheet if there are more values than columns. :param values: List of values for the n...
[ "def", "insert_row", "(", "self", ",", "values", ",", "index", "=", "1", ",", "value_input_option", "=", "'RAW'", ")", ":", "body", "=", "{", "\"requests\"", ":", "[", "{", "\"insertDimension\"", ":", "{", "\"range\"", ":", "{", "\"sheetId\"", ":", "self...
Adds a row to the worksheet at the specified index and populates it with values. Widens the worksheet if there are more values than columns. :param values: List of values for the new row. :param index: (optional) Offset for the newly inserted row. :type index: int :para...
[ "Adds", "a", "row", "to", "the", "worksheet", "at", "the", "specified", "index", "and", "populates", "it", "with", "values", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L895-L945
train
burnash/gspread
gspread/models.py
Worksheet.delete_row
def delete_row(self, index): """"Deletes the row from the worksheet at the specified index. :param index: Index of a row for deletion. :type index: int """ body = { "requests": [{ "deleteDimension": { "range": { ...
python
def delete_row(self, index): """"Deletes the row from the worksheet at the specified index. :param index: Index of a row for deletion. :type index: int """ body = { "requests": [{ "deleteDimension": { "range": { ...
[ "def", "delete_row", "(", "self", ",", "index", ")", ":", "body", "=", "{", "\"requests\"", ":", "[", "{", "\"deleteDimension\"", ":", "{", "\"range\"", ":", "{", "\"sheetId\"", ":", "self", ".", "id", ",", "\"dimension\"", ":", "\"ROWS\"", ",", "\"start...
Deletes the row from the worksheet at the specified index. :param index: Index of a row for deletion. :type index: int
[ "Deletes", "the", "row", "from", "the", "worksheet", "at", "the", "specified", "index", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L947-L966
train
burnash/gspread
gspread/models.py
Worksheet.find
def find(self, query): """Finds the first cell matching the query. :param query: A literal string to match or compiled regular expression. :type query: str, :py:class:`re.RegexObject` """ try: return self._finder(finditem, query) except StopIteration: ...
python
def find(self, query): """Finds the first cell matching the query. :param query: A literal string to match or compiled regular expression. :type query: str, :py:class:`re.RegexObject` """ try: return self._finder(finditem, query) except StopIteration: ...
[ "def", "find", "(", "self", ",", "query", ")", ":", "try", ":", "return", "self", ".", "_finder", "(", "finditem", ",", "query", ")", "except", "StopIteration", ":", "raise", "CellNotFound", "(", "query", ")" ]
Finds the first cell matching the query. :param query: A literal string to match or compiled regular expression. :type query: str, :py:class:`re.RegexObject`
[ "Finds", "the", "first", "cell", "matching", "the", "query", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L994-L1004
train
burnash/gspread
gspread/models.py
Worksheet.duplicate
def duplicate( self, insert_sheet_index=None, new_sheet_id=None, new_sheet_name=None ): """Duplicate the sheet. :param int insert_sheet_index: (optional) The zero-based index where the new sheet should be inserted. ...
python
def duplicate( self, insert_sheet_index=None, new_sheet_id=None, new_sheet_name=None ): """Duplicate the sheet. :param int insert_sheet_index: (optional) The zero-based index where the new sheet should be inserted. ...
[ "def", "duplicate", "(", "self", ",", "insert_sheet_index", "=", "None", ",", "new_sheet_id", "=", "None", ",", "new_sheet_name", "=", "None", ")", ":", "return", "self", ".", "spreadsheet", ".", "duplicate_sheet", "(", "self", ".", "id", ",", "insert_sheet_...
Duplicate the sheet. :param int insert_sheet_index: (optional) The zero-based index where the new sheet should be inserted. The index of all sheets after this are incremented. :param int...
[ "Duplicate", "the", "sheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L1028-L1057
train
burnash/gspread
gspread/utils.py
numericise
def numericise(value, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """Returns a value that depends on the input string: - Float if input can be converted to Float - Integer if input can be converted to integer - Zero if the input string is empty and empty...
python
def numericise(value, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """Returns a value that depends on the input string: - Float if input can be converted to Float - Integer if input can be converted to integer - Zero if the input string is empty and empty...
[ "def", "numericise", "(", "value", ",", "empty2zero", "=", "False", ",", "default_blank", "=", "\"\"", ",", "allow_underscores_in_numeric_literals", "=", "False", ")", ":", "if", "value", "is", "not", "None", ":", "if", "\"_\"", "in", "value", "and", "not", ...
Returns a value that depends on the input string: - Float if input can be converted to Float - Integer if input can be converted to integer - Zero if the input string is empty and empty2zero flag is set - The same input string, empty or not, otherwise. Executable examples: >>> ...
[ "Returns", "a", "value", "that", "depends", "on", "the", "input", "string", ":", "-", "Float", "if", "input", "can", "be", "converted", "to", "Float", "-", "Integer", "if", "input", "can", "be", "converted", "to", "integer", "-", "Zero", "if", "the", "...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L40-L87
train
burnash/gspread
gspread/utils.py
numericise_all
def numericise_all(input, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """Returns a list of numericised values from strings""" return [numericise(s, empty2zero, default_blank, allow_underscores_in_numeric_literals) for s in input]
python
def numericise_all(input, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """Returns a list of numericised values from strings""" return [numericise(s, empty2zero, default_blank, allow_underscores_in_numeric_literals) for s in input]
[ "def", "numericise_all", "(", "input", ",", "empty2zero", "=", "False", ",", "default_blank", "=", "\"\"", ",", "allow_underscores_in_numeric_literals", "=", "False", ")", ":", "return", "[", "numericise", "(", "s", ",", "empty2zero", ",", "default_blank", ",", ...
Returns a list of numericised values from strings
[ "Returns", "a", "list", "of", "numericised", "values", "from", "strings" ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L90-L92
train
burnash/gspread
gspread/utils.py
rowcol_to_a1
def rowcol_to_a1(row, col): """Translates a row and column cell address to A1 notation. :param row: The row of the cell to be converted. Rows start at index 1. :type row: int, str :param col: The column of the cell to be converted. Columns start at index 1. :type ro...
python
def rowcol_to_a1(row, col): """Translates a row and column cell address to A1 notation. :param row: The row of the cell to be converted. Rows start at index 1. :type row: int, str :param col: The column of the cell to be converted. Columns start at index 1. :type ro...
[ "def", "rowcol_to_a1", "(", "row", ",", "col", ")", ":", "row", "=", "int", "(", "row", ")", "col", "=", "int", "(", "col", ")", "if", "row", "<", "1", "or", "col", "<", "1", ":", "raise", "IncorrectCellLabel", "(", "'(%s, %s)'", "%", "(", "row",...
Translates a row and column cell address to A1 notation. :param row: The row of the cell to be converted. Rows start at index 1. :type row: int, str :param col: The column of the cell to be converted. Columns start at index 1. :type row: int, str :returns: a string...
[ "Translates", "a", "row", "and", "column", "cell", "address", "to", "A1", "notation", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L95-L132
train
burnash/gspread
gspread/utils.py
a1_to_rowcol
def a1_to_rowcol(label): """Translates a cell's address in A1 notation to a tuple of integers. :param label: A cell label in A1 notation, e.g. 'B1'. Letter case is ignored. :type label: str :returns: a tuple containing `row` and `column` numbers. Both indexed from 1 (on...
python
def a1_to_rowcol(label): """Translates a cell's address in A1 notation to a tuple of integers. :param label: A cell label in A1 notation, e.g. 'B1'. Letter case is ignored. :type label: str :returns: a tuple containing `row` and `column` numbers. Both indexed from 1 (on...
[ "def", "a1_to_rowcol", "(", "label", ")", ":", "m", "=", "CELL_ADDR_RE", ".", "match", "(", "label", ")", "if", "m", ":", "column_label", "=", "m", ".", "group", "(", "1", ")", ".", "upper", "(", ")", "row", "=", "int", "(", "m", ".", "group", ...
Translates a cell's address in A1 notation to a tuple of integers. :param label: A cell label in A1 notation, e.g. 'B1'. Letter case is ignored. :type label: str :returns: a tuple containing `row` and `column` numbers. Both indexed from 1 (one). Example: >>> a1_to...
[ "Translates", "a", "cell", "s", "address", "in", "A1", "notation", "to", "a", "tuple", "of", "integers", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L135-L162
train
burnash/gspread
gspread/utils.py
cast_to_a1_notation
def cast_to_a1_notation(method): """ Decorator function casts wrapped arguments to A1 notation in range method calls. """ @wraps(method) def wrapper(self, *args, **kwargs): try: if len(args): int(args[0]) # Convert to A1 notation range...
python
def cast_to_a1_notation(method): """ Decorator function casts wrapped arguments to A1 notation in range method calls. """ @wraps(method) def wrapper(self, *args, **kwargs): try: if len(args): int(args[0]) # Convert to A1 notation range...
[ "def", "cast_to_a1_notation", "(", "method", ")", ":", "@", "wraps", "(", "method", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "if", "len", "(", "args", ")", ":", "int", "(", "args", "[", ...
Decorator function casts wrapped arguments to A1 notation in range method calls.
[ "Decorator", "function", "casts", "wrapped", "arguments", "to", "A1", "notation", "in", "range", "method", "calls", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L165-L187
train
burnash/gspread
gspread/utils.py
wid_to_gid
def wid_to_gid(wid): """Calculate gid of a worksheet from its wid.""" widval = wid[1:] if len(wid) > 3 else wid xorval = 474 if len(wid) > 3 else 31578 return str(int(widval, 36) ^ xorval)
python
def wid_to_gid(wid): """Calculate gid of a worksheet from its wid.""" widval = wid[1:] if len(wid) > 3 else wid xorval = 474 if len(wid) > 3 else 31578 return str(int(widval, 36) ^ xorval)
[ "def", "wid_to_gid", "(", "wid", ")", ":", "widval", "=", "wid", "[", "1", ":", "]", "if", "len", "(", "wid", ")", ">", "3", "else", "wid", "xorval", "=", "474", "if", "len", "(", "wid", ")", ">", "3", "else", "31578", "return", "str", "(", "...
Calculate gid of a worksheet from its wid.
[ "Calculate", "gid", "of", "a", "worksheet", "from", "its", "wid", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L202-L206
train
burnash/gspread
gspread/client.py
Client.login
def login(self): """Authorize client.""" if not self.auth.access_token or \ (hasattr(self.auth, 'access_token_expired') and self.auth.access_token_expired): import httplib2 http = httplib2.Http() self.auth.refresh(http) self.session.headers.u...
python
def login(self): """Authorize client.""" if not self.auth.access_token or \ (hasattr(self.auth, 'access_token_expired') and self.auth.access_token_expired): import httplib2 http = httplib2.Http() self.auth.refresh(http) self.session.headers.u...
[ "def", "login", "(", "self", ")", ":", "if", "not", "self", ".", "auth", ".", "access_token", "or", "(", "hasattr", "(", "self", ".", "auth", ",", "'access_token_expired'", ")", "and", "self", ".", "auth", ".", "access_token_expired", ")", ":", "import",...
Authorize client.
[ "Authorize", "client", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L44-L55
train
burnash/gspread
gspread/client.py
Client.open
def open(self, title): """Opens a spreadsheet. :param title: A title of a spreadsheet. :type title: str :returns: a :class:`~gspread.models.Spreadsheet` instance. If there's more than one spreadsheet with same title the first one will be opened. :raises gsprea...
python
def open(self, title): """Opens a spreadsheet. :param title: A title of a spreadsheet. :type title: str :returns: a :class:`~gspread.models.Spreadsheet` instance. If there's more than one spreadsheet with same title the first one will be opened. :raises gsprea...
[ "def", "open", "(", "self", ",", "title", ")", ":", "try", ":", "properties", "=", "finditem", "(", "lambda", "x", ":", "x", "[", "'name'", "]", "==", "title", ",", "self", ".", "list_spreadsheet_files", "(", ")", ")", "# Drive uses different terminology",...
Opens a spreadsheet. :param title: A title of a spreadsheet. :type title: str :returns: a :class:`~gspread.models.Spreadsheet` instance. If there's more than one spreadsheet with same title the first one will be opened. :raises gspread.SpreadsheetNotFound: if no sprea...
[ "Opens", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L102-L131
train
burnash/gspread
gspread/client.py
Client.openall
def openall(self, title=None): """Opens all available spreadsheets. :param title: (optional) If specified can be used to filter spreadsheets by title. :type title: str :returns: a list of :class:`~gspread.models.Spreadsheet` instances. """ spreads...
python
def openall(self, title=None): """Opens all available spreadsheets. :param title: (optional) If specified can be used to filter spreadsheets by title. :type title: str :returns: a list of :class:`~gspread.models.Spreadsheet` instances. """ spreads...
[ "def", "openall", "(", "self", ",", "title", "=", "None", ")", ":", "spreadsheet_files", "=", "self", ".", "list_spreadsheet_files", "(", ")", "return", "[", "Spreadsheet", "(", "self", ",", "dict", "(", "title", "=", "x", "[", "'name'", "]", ",", "*",...
Opens all available spreadsheets. :param title: (optional) If specified can be used to filter spreadsheets by title. :type title: str :returns: a list of :class:`~gspread.models.Spreadsheet` instances.
[ "Opens", "all", "available", "spreadsheets", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L164-L179
train
burnash/gspread
gspread/client.py
Client.create
def create(self, title): """Creates a new spreadsheet. :param title: A title of a new spreadsheet. :type title: str :returns: a :class:`~gspread.models.Spreadsheet` instance. .. note:: In order to use this method, you need to add ``https://www.googleapis...
python
def create(self, title): """Creates a new spreadsheet. :param title: A title of a new spreadsheet. :type title: str :returns: a :class:`~gspread.models.Spreadsheet` instance. .. note:: In order to use this method, you need to add ``https://www.googleapis...
[ "def", "create", "(", "self", ",", "title", ")", ":", "payload", "=", "{", "'title'", ":", "title", ",", "'mimeType'", ":", "'application/vnd.google-apps.spreadsheet'", "}", "r", "=", "self", ".", "request", "(", "'post'", ",", "DRIVE_FILES_API_V2_URL", ",", ...
Creates a new spreadsheet. :param title: A title of a new spreadsheet. :type title: str :returns: a :class:`~gspread.models.Spreadsheet` instance. .. note:: In order to use this method, you need to add ``https://www.googleapis.com/auth/drive`` to your oAuth scop...
[ "Creates", "a", "new", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L181-L215
train
burnash/gspread
gspread/client.py
Client.copy
def copy(self, file_id, title=None, copy_permissions=False): """Copies a spreadsheet. :param file_id: A key of a spreadsheet to copy. :type title: str :param title: (optional) A title for the new spreadsheet. :type title: str :param copy_permissions: (optional) If True...
python
def copy(self, file_id, title=None, copy_permissions=False): """Copies a spreadsheet. :param file_id: A key of a spreadsheet to copy. :type title: str :param title: (optional) A title for the new spreadsheet. :type title: str :param copy_permissions: (optional) If True...
[ "def", "copy", "(", "self", ",", "file_id", ",", "title", "=", "None", ",", "copy_permissions", "=", "False", ")", ":", "url", "=", "'{0}/{1}/copy'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ")", "payload", "=", "{", "'title'", ":", ...
Copies a spreadsheet. :param file_id: A key of a spreadsheet to copy. :type title: str :param title: (optional) A title for the new spreadsheet. :type title: str :param copy_permissions: (optional) If True, copy permissions from original spreadsheet to new sprea...
[ "Copies", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L217-L286
train
burnash/gspread
gspread/client.py
Client.del_spreadsheet
def del_spreadsheet(self, file_id): """Deletes a spreadsheet. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str """ url = '{0}/{1}'.format( DRIVE_FILES_API_V2_URL, file_id ) self.request('delete', url)
python
def del_spreadsheet(self, file_id): """Deletes a spreadsheet. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str """ url = '{0}/{1}'.format( DRIVE_FILES_API_V2_URL, file_id ) self.request('delete', url)
[ "def", "del_spreadsheet", "(", "self", ",", "file_id", ")", ":", "url", "=", "'{0}/{1}'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ")", "self", ".", "request", "(", "'delete'", ",", "url", ")" ]
Deletes a spreadsheet. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str
[ "Deletes", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L288-L299
train
burnash/gspread
gspread/client.py
Client.import_csv
def import_csv(self, file_id, data): """Imports data into the first page of the spreadsheet. :param str data: A CSV string of data. Example: .. code:: # Read CSV file contents content = open('file_to_import.csv', 'r').read() gc.import_csv(spreadsh...
python
def import_csv(self, file_id, data): """Imports data into the first page of the spreadsheet. :param str data: A CSV string of data. Example: .. code:: # Read CSV file contents content = open('file_to_import.csv', 'r').read() gc.import_csv(spreadsh...
[ "def", "import_csv", "(", "self", ",", "file_id", ",", "data", ")", ":", "headers", "=", "{", "'Content-Type'", ":", "'text/csv'", "}", "url", "=", "'{0}/{1}'", ".", "format", "(", "DRIVE_FILES_UPLOAD_API_V2_URL", ",", "file_id", ")", "self", ".", "request",...
Imports data into the first page of the spreadsheet. :param str data: A CSV string of data. Example: .. code:: # Read CSV file contents content = open('file_to_import.csv', 'r').read() gc.import_csv(spreadsheet.id, content) .. note:: ...
[ "Imports", "data", "into", "the", "first", "page", "of", "the", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L301-L333
train
burnash/gspread
gspread/client.py
Client.list_permissions
def list_permissions(self, file_id): """Retrieve a list of permissions for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str """ url = '{0}/{1}/permissions'.format(DRIVE_FILES_API_V2_URL, file_id) r = self.request('get', url) return r.j...
python
def list_permissions(self, file_id): """Retrieve a list of permissions for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str """ url = '{0}/{1}/permissions'.format(DRIVE_FILES_API_V2_URL, file_id) r = self.request('get', url) return r.j...
[ "def", "list_permissions", "(", "self", ",", "file_id", ")", ":", "url", "=", "'{0}/{1}/permissions'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ")", "r", "=", "self", ".", "request", "(", "'get'", ",", "url", ")", "return", "r", ".", ...
Retrieve a list of permissions for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str
[ "Retrieve", "a", "list", "of", "permissions", "for", "a", "file", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L335-L345
train
burnash/gspread
gspread/client.py
Client.insert_permission
def insert_permission( self, file_id, value, perm_type, role, notify=True, email_message=None, with_link=False ): """Creates a new permission for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str ...
python
def insert_permission( self, file_id, value, perm_type, role, notify=True, email_message=None, with_link=False ): """Creates a new permission for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str ...
[ "def", "insert_permission", "(", "self", ",", "file_id", ",", "value", ",", "perm_type", ",", "role", ",", "notify", "=", "True", ",", "email_message", "=", "None", ",", "with_link", "=", "False", ")", ":", "url", "=", "'{0}/{1}/permissions'", ".", "format...
Creates a new permission for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str :param value: user or group e-mail address, domain name or None for 'default' type. :type value: str, None :param perm_type: (optional) The account type....
[ "Creates", "a", "new", "permission", "for", "a", "file", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L347-L421
train
burnash/gspread
gspread/client.py
Client.remove_permission
def remove_permission(self, file_id, permission_id): """Deletes a permission from a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str :param permission_id: an ID for the permission. :type permission_id: str """ url = '{0}/{1}/permissions/{2...
python
def remove_permission(self, file_id, permission_id): """Deletes a permission from a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str :param permission_id: an ID for the permission. :type permission_id: str """ url = '{0}/{1}/permissions/{2...
[ "def", "remove_permission", "(", "self", ",", "file_id", ",", "permission_id", ")", ":", "url", "=", "'{0}/{1}/permissions/{2}'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ",", "permission_id", ")", "self", ".", "request", "(", "'delete'", ",...
Deletes a permission from a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str :param permission_id: an ID for the permission. :type permission_id: str
[ "Deletes", "a", "permission", "from", "a", "file", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L423-L437
train
lmcinnes/umap
umap/utils.py
tau_rand_int
def tau_rand_int(state): """A fast (pseudo)-random number generator. Parameters ---------- state: array of int64, shape (3,) The internal state of the rng Returns ------- A (pseudo)-random int32 value """ state[0] = (((state[0] & 4294967294) << 12) & 0xffffffff) ^ ( ...
python
def tau_rand_int(state): """A fast (pseudo)-random number generator. Parameters ---------- state: array of int64, shape (3,) The internal state of the rng Returns ------- A (pseudo)-random int32 value """ state[0] = (((state[0] & 4294967294) << 12) & 0xffffffff) ^ ( ...
[ "def", "tau_rand_int", "(", "state", ")", ":", "state", "[", "0", "]", "=", "(", "(", "(", "state", "[", "0", "]", "&", "4294967294", ")", "<<", "12", ")", "&", "0xffffffff", ")", "^", "(", "(", "(", "(", "state", "[", "0", "]", "<<", "13", ...
A fast (pseudo)-random number generator. Parameters ---------- state: array of int64, shape (3,) The internal state of the rng Returns ------- A (pseudo)-random int32 value
[ "A", "fast", "(", "pseudo", ")", "-", "random", "number", "generator", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L12-L34
train
lmcinnes/umap
umap/utils.py
norm
def norm(vec): """Compute the (standard l2) norm of a vector. Parameters ---------- vec: array of shape (dim,) Returns ------- The l2 norm of vec. """ result = 0.0 for i in range(vec.shape[0]): result += vec[i] ** 2 return np.sqrt(result)
python
def norm(vec): """Compute the (standard l2) norm of a vector. Parameters ---------- vec: array of shape (dim,) Returns ------- The l2 norm of vec. """ result = 0.0 for i in range(vec.shape[0]): result += vec[i] ** 2 return np.sqrt(result)
[ "def", "norm", "(", "vec", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "vec", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "vec", "[", "i", "]", "**", "2", "return", "np", ".", "sqrt", "(", "result", ")" ]
Compute the (standard l2) norm of a vector. Parameters ---------- vec: array of shape (dim,) Returns ------- The l2 norm of vec.
[ "Compute", "the", "(", "standard", "l2", ")", "norm", "of", "a", "vector", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L55-L69
train
lmcinnes/umap
umap/utils.py
rejection_sample
def rejection_sample(n_samples, pool_size, rng_state): """Generate n_samples many integers from 0 to pool_size such that no integer is selected twice. The duplication constraint is achieved via rejection sampling. Parameters ---------- n_samples: int The number of random samples to sele...
python
def rejection_sample(n_samples, pool_size, rng_state): """Generate n_samples many integers from 0 to pool_size such that no integer is selected twice. The duplication constraint is achieved via rejection sampling. Parameters ---------- n_samples: int The number of random samples to sele...
[ "def", "rejection_sample", "(", "n_samples", ",", "pool_size", ",", "rng_state", ")", ":", "result", "=", "np", ".", "empty", "(", "n_samples", ",", "dtype", "=", "np", ".", "int64", ")", "for", "i", "in", "range", "(", "n_samples", ")", ":", "reject_s...
Generate n_samples many integers from 0 to pool_size such that no integer is selected twice. The duplication constraint is achieved via rejection sampling. Parameters ---------- n_samples: int The number of random samples to select from the pool pool_size: int The size of the t...
[ "Generate", "n_samples", "many", "integers", "from", "0", "to", "pool_size", "such", "that", "no", "integer", "is", "selected", "twice", ".", "The", "duplication", "constraint", "is", "achieved", "via", "rejection", "sampling", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L73-L105
train
lmcinnes/umap
umap/utils.py
make_heap
def make_heap(n_points, size): """Constructor for the numba enabled heap objects. The heaps are used for approximate nearest neighbor search, maintaining a list of potential neighbors sorted by their distance. We also flag if potential neighbors are newly added to the list or not. Internally this is sto...
python
def make_heap(n_points, size): """Constructor for the numba enabled heap objects. The heaps are used for approximate nearest neighbor search, maintaining a list of potential neighbors sorted by their distance. We also flag if potential neighbors are newly added to the list or not. Internally this is sto...
[ "def", "make_heap", "(", "n_points", ",", "size", ")", ":", "result", "=", "np", ".", "zeros", "(", "(", "3", ",", "int", "(", "n_points", ")", ",", "int", "(", "size", ")", ")", ",", "dtype", "=", "np", ".", "float64", ")", "result", "[", "0",...
Constructor for the numba enabled heap objects. The heaps are used for approximate nearest neighbor search, maintaining a list of potential neighbors sorted by their distance. We also flag if potential neighbors are newly added to the list or not. Internally this is stored as a single ndarray; the first...
[ "Constructor", "for", "the", "numba", "enabled", "heap", "objects", ".", "The", "heaps", "are", "used", "for", "approximate", "nearest", "neighbor", "search", "maintaining", "a", "list", "of", "potential", "neighbors", "sorted", "by", "their", "distance", ".", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L109-L136
train
lmcinnes/umap
umap/utils.py
siftdown
def siftdown(heap1, heap2, elt): """Restore the heap property for a heap with an out of place element at position ``elt``. This works with a heap pair where heap1 carries the weights and heap2 holds the corresponding elements.""" while elt * 2 + 1 < heap1.shape[0]: left_child = elt * 2 + 1 ...
python
def siftdown(heap1, heap2, elt): """Restore the heap property for a heap with an out of place element at position ``elt``. This works with a heap pair where heap1 carries the weights and heap2 holds the corresponding elements.""" while elt * 2 + 1 < heap1.shape[0]: left_child = elt * 2 + 1 ...
[ "def", "siftdown", "(", "heap1", ",", "heap2", ",", "elt", ")", ":", "while", "elt", "*", "2", "+", "1", "<", "heap1", ".", "shape", "[", "0", "]", ":", "left_child", "=", "elt", "*", "2", "+", "1", "right_child", "=", "left_child", "+", "1", "...
Restore the heap property for a heap with an out of place element at position ``elt``. This works with a heap pair where heap1 carries the weights and heap2 holds the corresponding elements.
[ "Restore", "the", "heap", "property", "for", "a", "heap", "with", "an", "out", "of", "place", "element", "at", "position", "elt", ".", "This", "works", "with", "a", "heap", "pair", "where", "heap1", "carries", "the", "weights", "and", "heap2", "holds", "...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L302-L322
train
lmcinnes/umap
umap/utils.py
deheap_sort
def deheap_sort(heap): """Given an array of heaps (of indices and weights), unpack the heap out to give and array of sorted lists of indices and weights by increasing weight. This is effectively just the second half of heap sort (the first half not being required since we already have the data in a heap...
python
def deheap_sort(heap): """Given an array of heaps (of indices and weights), unpack the heap out to give and array of sorted lists of indices and weights by increasing weight. This is effectively just the second half of heap sort (the first half not being required since we already have the data in a heap...
[ "def", "deheap_sort", "(", "heap", ")", ":", "indices", "=", "heap", "[", "0", "]", "weights", "=", "heap", "[", "1", "]", "for", "i", "in", "range", "(", "indices", ".", "shape", "[", "0", "]", ")", ":", "ind_heap", "=", "indices", "[", "i", "...
Given an array of heaps (of indices and weights), unpack the heap out to give and array of sorted lists of indices and weights by increasing weight. This is effectively just the second half of heap sort (the first half not being required since we already have the data in a heap). Parameters -------...
[ "Given", "an", "array", "of", "heaps", "(", "of", "indices", "and", "weights", ")", "unpack", "the", "heap", "out", "to", "give", "and", "array", "of", "sorted", "lists", "of", "indices", "and", "weights", "by", "increasing", "weight", ".", "This", "is",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L326-L366
train
lmcinnes/umap
umap/utils.py
smallest_flagged
def smallest_flagged(heap, row): """Search the heap for the smallest element that is still flagged. Parameters ---------- heap: array of shape (3, n_samples, n_neighbors) The heaps to search row: int Which of the heaps to search Returns ------- index: int T...
python
def smallest_flagged(heap, row): """Search the heap for the smallest element that is still flagged. Parameters ---------- heap: array of shape (3, n_samples, n_neighbors) The heaps to search row: int Which of the heaps to search Returns ------- index: int T...
[ "def", "smallest_flagged", "(", "heap", ",", "row", ")", ":", "ind", "=", "heap", "[", "0", ",", "row", "]", "dist", "=", "heap", "[", "1", ",", "row", "]", "flag", "=", "heap", "[", "2", ",", "row", "]", "min_dist", "=", "np", ".", "inf", "r...
Search the heap for the smallest element that is still flagged. Parameters ---------- heap: array of shape (3, n_samples, n_neighbors) The heaps to search row: int Which of the heaps to search Returns ------- index: int The index of the smallest flagged element...
[ "Search", "the", "heap", "for", "the", "smallest", "element", "that", "is", "still", "flagged", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L370-L405
train
lmcinnes/umap
umap/utils.py
build_candidates
def build_candidates(current_graph, n_vertices, n_neighbors, max_candidates, rng_state): """Build a heap of candidate neighbors for nearest neighbor descent. For each vertex the candidate neighbors are any current neighbors, and any vertices that have the vertex as one of their nearest neighbors. Param...
python
def build_candidates(current_graph, n_vertices, n_neighbors, max_candidates, rng_state): """Build a heap of candidate neighbors for nearest neighbor descent. For each vertex the candidate neighbors are any current neighbors, and any vertices that have the vertex as one of their nearest neighbors. Param...
[ "def", "build_candidates", "(", "current_graph", ",", "n_vertices", ",", "n_neighbors", ",", "max_candidates", ",", "rng_state", ")", ":", "candidate_neighbors", "=", "make_heap", "(", "n_vertices", ",", "max_candidates", ")", "for", "i", "in", "range", "(", "n_...
Build a heap of candidate neighbors for nearest neighbor descent. For each vertex the candidate neighbors are any current neighbors, and any vertices that have the vertex as one of their nearest neighbors. Parameters ---------- current_graph: heap The current state of the graph for nearest ...
[ "Build", "a", "heap", "of", "candidate", "neighbors", "for", "nearest", "neighbor", "descent", ".", "For", "each", "vertex", "the", "candidate", "neighbors", "are", "any", "current", "neighbors", "and", "any", "vertices", "that", "have", "the", "vertex", "as",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L409-L448
train
lmcinnes/umap
umap/utils.py
new_build_candidates
def new_build_candidates( current_graph, n_vertices, n_neighbors, max_candidates, rng_state, rho=0.5 ): # pragma: no cover """Build a heap of candidate neighbors for nearest neighbor descent. For each vertex the candidate neighbors are any current neighbors, and any vertices that have the vertex as one...
python
def new_build_candidates( current_graph, n_vertices, n_neighbors, max_candidates, rng_state, rho=0.5 ): # pragma: no cover """Build a heap of candidate neighbors for nearest neighbor descent. For each vertex the candidate neighbors are any current neighbors, and any vertices that have the vertex as one...
[ "def", "new_build_candidates", "(", "current_graph", ",", "n_vertices", ",", "n_neighbors", ",", "max_candidates", ",", "rng_state", ",", "rho", "=", "0.5", ")", ":", "# pragma: no cover", "new_candidate_neighbors", "=", "make_heap", "(", "n_vertices", ",", "max_can...
Build a heap of candidate neighbors for nearest neighbor descent. For each vertex the candidate neighbors are any current neighbors, and any vertices that have the vertex as one of their nearest neighbors. Parameters ---------- current_graph: heap The current state of the graph for nearest ...
[ "Build", "a", "heap", "of", "candidate", "neighbors", "for", "nearest", "neighbor", "descent", ".", "For", "each", "vertex", "the", "candidate", "neighbors", "are", "any", "current", "neighbors", "and", "any", "vertices", "that", "have", "the", "vertex", "as",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L452-L503
train
lmcinnes/umap
umap/utils.py
submatrix
def submatrix(dmat, indices_col, n_neighbors): """Return a submatrix given an orginal matrix and the indices to keep. Parameters ---------- mat: array, shape (n_samples, n_samples) Original matrix. indices_col: array, shape (n_samples, n_neighbors) Indices to keep. Each row consist...
python
def submatrix(dmat, indices_col, n_neighbors): """Return a submatrix given an orginal matrix and the indices to keep. Parameters ---------- mat: array, shape (n_samples, n_samples) Original matrix. indices_col: array, shape (n_samples, n_neighbors) Indices to keep. Each row consist...
[ "def", "submatrix", "(", "dmat", ",", "indices_col", ",", "n_neighbors", ")", ":", "n_samples_transform", ",", "n_samples_fit", "=", "dmat", ".", "shape", "submat", "=", "np", ".", "zeros", "(", "(", "n_samples_transform", ",", "n_neighbors", ")", ",", "dtyp...
Return a submatrix given an orginal matrix and the indices to keep. Parameters ---------- mat: array, shape (n_samples, n_samples) Original matrix. indices_col: array, shape (n_samples, n_neighbors) Indices to keep. Each row consists of the indices of the columns. n_neighbors: int...
[ "Return", "a", "submatrix", "given", "an", "orginal", "matrix", "and", "the", "indices", "to", "keep", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L507-L531
train
lmcinnes/umap
umap/distances.py
euclidean
def euclidean(x, y): """Standard euclidean distance. ..math:: D(x, y) = \sqrt{\sum_i (x_i - y_i)^2} """ result = 0.0 for i in range(x.shape[0]): result += (x[i] - y[i]) ** 2 return np.sqrt(result)
python
def euclidean(x, y): """Standard euclidean distance. ..math:: D(x, y) = \sqrt{\sum_i (x_i - y_i)^2} """ result = 0.0 for i in range(x.shape[0]): result += (x[i] - y[i]) ** 2 return np.sqrt(result)
[ "def", "euclidean", "(", "x", ",", "y", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "(", "x", "[", "i", "]", "-", "y", "[", "i", "]", ")", "**", "2", "return"...
Standard euclidean distance. ..math:: D(x, y) = \sqrt{\sum_i (x_i - y_i)^2}
[ "Standard", "euclidean", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L12-L21
train
lmcinnes/umap
umap/distances.py
standardised_euclidean
def standardised_euclidean(x, y, sigma=_mock_ones): """Euclidean distance standardised against a vector of standard deviations per coordinate. ..math:: D(x, y) = \sqrt{\sum_i \frac{(x_i - y_i)**2}{v_i}} """ result = 0.0 for i in range(x.shape[0]): result += ((x[i] - y[i]) ** 2) ...
python
def standardised_euclidean(x, y, sigma=_mock_ones): """Euclidean distance standardised against a vector of standard deviations per coordinate. ..math:: D(x, y) = \sqrt{\sum_i \frac{(x_i - y_i)**2}{v_i}} """ result = 0.0 for i in range(x.shape[0]): result += ((x[i] - y[i]) ** 2) ...
[ "def", "standardised_euclidean", "(", "x", ",", "y", ",", "sigma", "=", "_mock_ones", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "(", "(", "x", "[", "i", "]", "-",...
Euclidean distance standardised against a vector of standard deviations per coordinate. ..math:: D(x, y) = \sqrt{\sum_i \frac{(x_i - y_i)**2}{v_i}}
[ "Euclidean", "distance", "standardised", "against", "a", "vector", "of", "standard", "deviations", "per", "coordinate", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L25-L36
train
lmcinnes/umap
umap/distances.py
manhattan
def manhattan(x, y): """Manhatten, taxicab, or l1 distance. ..math:: D(x, y) = \sum_i |x_i - y_i| """ result = 0.0 for i in range(x.shape[0]): result += np.abs(x[i] - y[i]) return result
python
def manhattan(x, y): """Manhatten, taxicab, or l1 distance. ..math:: D(x, y) = \sum_i |x_i - y_i| """ result = 0.0 for i in range(x.shape[0]): result += np.abs(x[i] - y[i]) return result
[ "def", "manhattan", "(", "x", ",", "y", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "np", ".", "abs", "(", "x", "[", "i", "]", "-", "y", "[", "i", "]", ")", ...
Manhatten, taxicab, or l1 distance. ..math:: D(x, y) = \sum_i |x_i - y_i|
[ "Manhatten", "taxicab", "or", "l1", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L40-L50
train
lmcinnes/umap
umap/distances.py
chebyshev
def chebyshev(x, y): """Chebyshev or l-infinity distance. ..math:: D(x, y) = \max_i |x_i - y_i| """ result = 0.0 for i in range(x.shape[0]): result = max(result, np.abs(x[i] - y[i])) return result
python
def chebyshev(x, y): """Chebyshev or l-infinity distance. ..math:: D(x, y) = \max_i |x_i - y_i| """ result = 0.0 for i in range(x.shape[0]): result = max(result, np.abs(x[i] - y[i])) return result
[ "def", "chebyshev", "(", "x", ",", "y", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "=", "max", "(", "result", ",", "np", ".", "abs", "(", "x", "[", "i", "]", "-", ...
Chebyshev or l-infinity distance. ..math:: D(x, y) = \max_i |x_i - y_i|
[ "Chebyshev", "or", "l", "-", "infinity", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L54-L64
train
lmcinnes/umap
umap/distances.py
minkowski
def minkowski(x, y, p=2): """Minkowski distance. ..math:: D(x, y) = \left(\sum_i |x_i - y_i|^p\right)^{\frac{1}{p}} This is a general distance. For p=1 it is equivalent to manhattan distance, for p=2 it is Euclidean distance, and for p=infinity it is Chebyshev distance. In general it is be...
python
def minkowski(x, y, p=2): """Minkowski distance. ..math:: D(x, y) = \left(\sum_i |x_i - y_i|^p\right)^{\frac{1}{p}} This is a general distance. For p=1 it is equivalent to manhattan distance, for p=2 it is Euclidean distance, and for p=infinity it is Chebyshev distance. In general it is be...
[ "def", "minkowski", "(", "x", ",", "y", ",", "p", "=", "2", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "(", "np", ".", "abs", "(", "x", "[", "i", "]", "-", ...
Minkowski distance. ..math:: D(x, y) = \left(\sum_i |x_i - y_i|^p\right)^{\frac{1}{p}} This is a general distance. For p=1 it is equivalent to manhattan distance, for p=2 it is Euclidean distance, and for p=infinity it is Chebyshev distance. In general it is better to use the more speciali...
[ "Minkowski", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L68-L83
train
lmcinnes/umap
umap/nndescent.py
make_nn_descent
def make_nn_descent(dist, dist_args): """Create a numba accelerated version of nearest neighbor descent specialised for the given distance metric and metric arguments. Numba doesn't support higher order functions directly, but we can instead JIT compile the version of NN-descent for any given metric. ...
python
def make_nn_descent(dist, dist_args): """Create a numba accelerated version of nearest neighbor descent specialised for the given distance metric and metric arguments. Numba doesn't support higher order functions directly, but we can instead JIT compile the version of NN-descent for any given metric. ...
[ "def", "make_nn_descent", "(", "dist", ",", "dist_args", ")", ":", "@", "numba", ".", "njit", "(", "parallel", "=", "True", ")", "def", "nn_descent", "(", "data", ",", "n_neighbors", ",", "rng_state", ",", "max_candidates", "=", "50", ",", "n_iters", "="...
Create a numba accelerated version of nearest neighbor descent specialised for the given distance metric and metric arguments. Numba doesn't support higher order functions directly, but we can instead JIT compile the version of NN-descent for any given metric. Parameters ---------- dist: functi...
[ "Create", "a", "numba", "accelerated", "version", "of", "nearest", "neighbor", "descent", "specialised", "for", "the", "given", "distance", "metric", "and", "metric", "arguments", ".", "Numba", "doesn", "t", "support", "higher", "order", "functions", "directly", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/nndescent.py#L24-L119
train
lmcinnes/umap
umap/spectral.py
component_layout
def component_layout( data, n_components, component_labels, dim, metric="euclidean", metric_kwds={} ): """Provide a layout relating the separate connected components. This is done by taking the centroid of each component and then performing a spectral embedding of the centroids. Parameters ----...
python
def component_layout( data, n_components, component_labels, dim, metric="euclidean", metric_kwds={} ): """Provide a layout relating the separate connected components. This is done by taking the centroid of each component and then performing a spectral embedding of the centroids. Parameters ----...
[ "def", "component_layout", "(", "data", ",", "n_components", ",", "component_labels", ",", "dim", ",", "metric", "=", "\"euclidean\"", ",", "metric_kwds", "=", "{", "}", ")", ":", "component_centroids", "=", "np", ".", "empty", "(", "(", "n_components", ",",...
Provide a layout relating the separate connected components. This is done by taking the centroid of each component and then performing a spectral embedding of the centroids. Parameters ---------- data: array of shape (n_samples, n_features) The source data -- required so we can generate cen...
[ "Provide", "a", "layout", "relating", "the", "separate", "connected", "components", ".", "This", "is", "done", "by", "taking", "the", "centroid", "of", "each", "component", "and", "then", "performing", "a", "spectral", "embedding", "of", "the", "centroids", "....
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/spectral.py#L11-L62
train