id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
222,900
Guake/guake
guake/dialogs.py
PromptQuitDialog.quit
def quit(self): """Run the "are you sure" dialog for quitting Guake """ # Stop an open "close tab" dialog from obstructing a quit response = self.run() == Gtk.ResponseType.YES self.destroy() # Keep Guake focussed after dismissing tab-close prompt # if tab == -1: ...
python
def quit(self): """Run the "are you sure" dialog for quitting Guake """ # Stop an open "close tab" dialog from obstructing a quit response = self.run() == Gtk.ResponseType.YES self.destroy() # Keep Guake focussed after dismissing tab-close prompt # if tab == -1: ...
[ "def", "quit", "(", "self", ")", ":", "# Stop an open \"close tab\" dialog from obstructing a quit", "response", "=", "self", ".", "run", "(", ")", "==", "Gtk", ".", "ResponseType", ".", "YES", "self", ".", "destroy", "(", ")", "# Keep Guake focussed after dismissin...
Run the "are you sure" dialog for quitting Guake
[ "Run", "the", "are", "you", "sure", "dialog", "for", "quitting", "Guake" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/dialogs.py#L70-L79
222,901
Guake/guake
guake/boxes.py
TerminalBox.set_terminal
def set_terminal(self, terminal): """Packs the terminal widget. """ if self.terminal is not None: raise RuntimeError("TerminalBox: terminal already set") self.terminal = terminal self.terminal.connect("grab-focus", self.on_terminal_focus) self.terminal.connect...
python
def set_terminal(self, terminal): """Packs the terminal widget. """ if self.terminal is not None: raise RuntimeError("TerminalBox: terminal already set") self.terminal = terminal self.terminal.connect("grab-focus", self.on_terminal_focus) self.terminal.connect...
[ "def", "set_terminal", "(", "self", ",", "terminal", ")", ":", "if", "self", ".", "terminal", "is", "not", "None", ":", "raise", "RuntimeError", "(", "\"TerminalBox: terminal already set\"", ")", "self", ".", "terminal", "=", "terminal", "self", ".", "terminal...
Packs the terminal widget.
[ "Packs", "the", "terminal", "widget", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/boxes.py#L309-L321
222,902
Guake/guake
guake/boxes.py
TerminalBox.add_scroll_bar
def add_scroll_bar(self): """Packs the scrollbar. """ adj = self.terminal.get_vadjustment() scroll = Gtk.VScrollbar(adj) scroll.show() self.pack_start(scroll, False, False, 0)
python
def add_scroll_bar(self): """Packs the scrollbar. """ adj = self.terminal.get_vadjustment() scroll = Gtk.VScrollbar(adj) scroll.show() self.pack_start(scroll, False, False, 0)
[ "def", "add_scroll_bar", "(", "self", ")", ":", "adj", "=", "self", ".", "terminal", ".", "get_vadjustment", "(", ")", "scroll", "=", "Gtk", ".", "VScrollbar", "(", "adj", ")", "scroll", ".", "show", "(", ")", "self", ".", "pack_start", "(", "scroll", ...
Packs the scrollbar.
[ "Packs", "the", "scrollbar", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/boxes.py#L323-L329
222,903
Guake/guake
guake/guake_app.py
Guake.execute_command
def execute_command(self, command, tab=None): # TODO DBUS_ONLY """Execute the `command' in the `tab'. If tab is None, the command will be executed in the currently selected tab. Command should end with '\n', otherwise it will be appended to the string. """ # TODO ...
python
def execute_command(self, command, tab=None): # TODO DBUS_ONLY """Execute the `command' in the `tab'. If tab is None, the command will be executed in the currently selected tab. Command should end with '\n', otherwise it will be appended to the string. """ # TODO ...
[ "def", "execute_command", "(", "self", ",", "command", ",", "tab", "=", "None", ")", ":", "# TODO DBUS_ONLY", "# TODO CONTEXTMENU this has to be rewriten and only serves the", "# dbus interface, maybe this should be moved to dbusinterface.py", "if", "not", "self", ".", "get_not...
Execute the `command' in the `tab'. If tab is None, the command will be executed in the currently selected tab. Command should end with '\n', otherwise it will be appended to the string.
[ "Execute", "the", "command", "in", "the", "tab", ".", "If", "tab", "is", "None", "the", "command", "will", "be", "executed", "in", "the", "currently", "selected", "tab", ".", "Command", "should", "end", "with", "\\", "n", "otherwise", "it", "will", "be",...
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L386-L402
222,904
Guake/guake
guake/guake_app.py
Guake.execute_command_by_uuid
def execute_command_by_uuid(self, tab_uuid, command): # TODO DBUS_ONLY """Execute the `command' in the tab whose terminal has the `tab_uuid' uuid """ if command[-1] != '\n': command += '\n' try: tab_uuid = uuid.UUID(tab_uuid) page_index, = ( ...
python
def execute_command_by_uuid(self, tab_uuid, command): # TODO DBUS_ONLY """Execute the `command' in the tab whose terminal has the `tab_uuid' uuid """ if command[-1] != '\n': command += '\n' try: tab_uuid = uuid.UUID(tab_uuid) page_index, = ( ...
[ "def", "execute_command_by_uuid", "(", "self", ",", "tab_uuid", ",", "command", ")", ":", "# TODO DBUS_ONLY", "if", "command", "[", "-", "1", "]", "!=", "'\\n'", ":", "command", "+=", "'\\n'", "try", ":", "tab_uuid", "=", "uuid", ".", "UUID", "(", "tab_u...
Execute the `command' in the tab whose terminal has the `tab_uuid' uuid
[ "Execute", "the", "command", "in", "the", "tab", "whose", "terminal", "has", "the", "tab_uuid", "uuid" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L404-L421
222,905
Guake/guake
guake/guake_app.py
Guake.on_window_losefocus
def on_window_losefocus(self, window, event): """Hides terminal main window when it loses the focus and if the window_losefocus gconf variable is True. """ if not HidePrevention(self.window).may_hide(): return value = self.settings.general.get_boolean('window-losefoc...
python
def on_window_losefocus(self, window, event): """Hides terminal main window when it loses the focus and if the window_losefocus gconf variable is True. """ if not HidePrevention(self.window).may_hide(): return value = self.settings.general.get_boolean('window-losefoc...
[ "def", "on_window_losefocus", "(", "self", ",", "window", ",", "event", ")", ":", "if", "not", "HidePrevention", "(", "self", ".", "window", ")", ".", "may_hide", "(", ")", ":", "return", "value", "=", "self", ".", "settings", ".", "general", ".", "get...
Hides terminal main window when it loses the focus and if the window_losefocus gconf variable is True.
[ "Hides", "terminal", "main", "window", "when", "it", "loses", "the", "focus", "and", "if", "the", "window_losefocus", "gconf", "variable", "is", "True", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L423-L435
222,906
Guake/guake
guake/guake_app.py
Guake.show_menu
def show_menu(self, status_icon, button, activate_time): """Show the tray icon menu. """ menu = self.get_widget('tray-menu') menu.popup(None, None, None, Gtk.StatusIcon.position_menu, button, activate_time)
python
def show_menu(self, status_icon, button, activate_time): """Show the tray icon menu. """ menu = self.get_widget('tray-menu') menu.popup(None, None, None, Gtk.StatusIcon.position_menu, button, activate_time)
[ "def", "show_menu", "(", "self", ",", "status_icon", ",", "button", ",", "activate_time", ")", ":", "menu", "=", "self", ".", "get_widget", "(", "'tray-menu'", ")", "menu", ".", "popup", "(", "None", ",", "None", ",", "None", ",", "Gtk", ".", "StatusIc...
Show the tray icon menu.
[ "Show", "the", "tray", "icon", "menu", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L437-L441
222,907
Guake/guake
guake/guake_app.py
Guake.show_hide
def show_hide(self, *args): """Toggles the main window visibility """ log.debug("Show_hide called") if self.forceHide: self.forceHide = False return if not HidePrevention(self.window).may_hide(): return if not self.win_prepare(): ...
python
def show_hide(self, *args): """Toggles the main window visibility """ log.debug("Show_hide called") if self.forceHide: self.forceHide = False return if not HidePrevention(self.window).may_hide(): return if not self.win_prepare(): ...
[ "def", "show_hide", "(", "self", ",", "*", "args", ")", ":", "log", ".", "debug", "(", "\"Show_hide called\"", ")", "if", "self", ".", "forceHide", ":", "self", ".", "forceHide", "=", "False", "return", "if", "not", "HidePrevention", "(", "self", ".", ...
Toggles the main window visibility
[ "Toggles", "the", "main", "window", "visibility" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L472-L518
222,908
Guake/guake
guake/guake_app.py
Guake.show
def show(self): """Shows the main window and grabs the focus on it. """ self.hidden = False # setting window in all desktops window_rect = RectCalculator.set_final_window_rect(self.settings, self.window) self.window.stick() # add tab must be called before windo...
python
def show(self): """Shows the main window and grabs the focus on it. """ self.hidden = False # setting window in all desktops window_rect = RectCalculator.set_final_window_rect(self.settings, self.window) self.window.stick() # add tab must be called before windo...
[ "def", "show", "(", "self", ")", ":", "self", ".", "hidden", "=", "False", "# setting window in all desktops", "window_rect", "=", "RectCalculator", ".", "set_final_window_rect", "(", "self", ".", "settings", ",", "self", ".", "window", ")", "self", ".", "wind...
Shows the main window and grabs the focus on it.
[ "Shows", "the", "main", "window", "and", "grabs", "the", "focus", "on", "it", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L568-L641
222,909
Guake/guake
guake/guake_app.py
Guake.hide
def hide(self): """Hides the main window of the terminal and sets the visible flag to False. """ if not HidePrevention(self.window).may_hide(): return self.hidden = True self.get_widget('window-root').unstick() self.window.hide()
python
def hide(self): """Hides the main window of the terminal and sets the visible flag to False. """ if not HidePrevention(self.window).may_hide(): return self.hidden = True self.get_widget('window-root').unstick() self.window.hide()
[ "def", "hide", "(", "self", ")", ":", "if", "not", "HidePrevention", "(", "self", ".", "window", ")", ".", "may_hide", "(", ")", ":", "return", "self", ".", "hidden", "=", "True", "self", ".", "get_widget", "(", "'window-root'", ")", ".", "unstick", ...
Hides the main window of the terminal and sets the visible flag to False.
[ "Hides", "the", "main", "window", "of", "the", "terminal", "and", "sets", "the", "visible", "flag", "to", "False", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L660-L668
222,910
Guake/guake
guake/guake_app.py
Guake.load_config
def load_config(self): """"Just a proxy for all the configuration stuff. """ self.settings.general.triggerOnChangedValue(self.settings.general, 'use-trayicon') self.settings.general.triggerOnChangedValue(self.settings.general, 'prompt-on-quit') self.settings.general.triggerOnCha...
python
def load_config(self): """"Just a proxy for all the configuration stuff. """ self.settings.general.triggerOnChangedValue(self.settings.general, 'use-trayicon') self.settings.general.triggerOnChangedValue(self.settings.general, 'prompt-on-quit') self.settings.general.triggerOnCha...
[ "def", "load_config", "(", "self", ")", ":", "self", ".", "settings", ".", "general", ".", "triggerOnChangedValue", "(", "self", ".", "settings", ".", "general", ",", "'use-trayicon'", ")", "self", ".", "settings", ".", "general", ".", "triggerOnChangedValue",...
Just a proxy for all the configuration stuff.
[ "Just", "a", "proxy", "for", "all", "the", "configuration", "stuff", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L681-L716
222,911
Guake/guake
guake/guake_app.py
Guake.accel_quit
def accel_quit(self, *args): """Callback to prompt the user whether to quit Guake or not. """ procs = self.notebook_manager.get_running_fg_processes_count() tabs = self.notebook_manager.get_n_pages() notebooks = self.notebook_manager.get_n_notebooks() prompt_cfg = self.se...
python
def accel_quit(self, *args): """Callback to prompt the user whether to quit Guake or not. """ procs = self.notebook_manager.get_running_fg_processes_count() tabs = self.notebook_manager.get_n_pages() notebooks = self.notebook_manager.get_n_notebooks() prompt_cfg = self.se...
[ "def", "accel_quit", "(", "self", ",", "*", "args", ")", ":", "procs", "=", "self", ".", "notebook_manager", ".", "get_running_fg_processes_count", "(", ")", "tabs", "=", "self", ".", "notebook_manager", ".", "get_n_pages", "(", ")", "notebooks", "=", "self"...
Callback to prompt the user whether to quit Guake or not.
[ "Callback", "to", "prompt", "the", "user", "whether", "to", "quit", "Guake", "or", "not", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L739-L755
222,912
Guake/guake
guake/guake_app.py
Guake.accel_reset_terminal
def accel_reset_terminal(self, *args): # TODO KEYBINDINGS ONLY """Callback to reset and clean the terminal""" HidePrevention(self.window).prevent() current_term = self.get_notebook().get_current_terminal() current_term.reset(True, True) HidePrevention(self.window).allow()...
python
def accel_reset_terminal(self, *args): # TODO KEYBINDINGS ONLY """Callback to reset and clean the terminal""" HidePrevention(self.window).prevent() current_term = self.get_notebook().get_current_terminal() current_term.reset(True, True) HidePrevention(self.window).allow()...
[ "def", "accel_reset_terminal", "(", "self", ",", "*", "args", ")", ":", "# TODO KEYBINDINGS ONLY", "HidePrevention", "(", "self", ".", "window", ")", ".", "prevent", "(", ")", "current_term", "=", "self", ".", "get_notebook", "(", ")", ".", "get_current_termin...
Callback to reset and clean the terminal
[ "Callback", "to", "reset", "and", "clean", "the", "terminal" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L757-L764
222,913
Guake/guake
guake/guake_app.py
Guake.accel_zoom_in
def accel_zoom_in(self, *args): """Callback to zoom in. """ for term in self.get_notebook().iter_terminals(): term.increase_font_size() return True
python
def accel_zoom_in(self, *args): """Callback to zoom in. """ for term in self.get_notebook().iter_terminals(): term.increase_font_size() return True
[ "def", "accel_zoom_in", "(", "self", ",", "*", "args", ")", ":", "for", "term", "in", "self", ".", "get_notebook", "(", ")", ".", "iter_terminals", "(", ")", ":", "term", ".", "increase_font_size", "(", ")", "return", "True" ]
Callback to zoom in.
[ "Callback", "to", "zoom", "in", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L766-L771
222,914
Guake/guake
guake/guake_app.py
Guake.accel_zoom_out
def accel_zoom_out(self, *args): """Callback to zoom out. """ for term in self.get_notebook().iter_terminals(): term.decrease_font_size() return True
python
def accel_zoom_out(self, *args): """Callback to zoom out. """ for term in self.get_notebook().iter_terminals(): term.decrease_font_size() return True
[ "def", "accel_zoom_out", "(", "self", ",", "*", "args", ")", ":", "for", "term", "in", "self", ".", "get_notebook", "(", ")", ".", "iter_terminals", "(", ")", ":", "term", ".", "decrease_font_size", "(", ")", "return", "True" ]
Callback to zoom out.
[ "Callback", "to", "zoom", "out", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L773-L778
222,915
Guake/guake
guake/guake_app.py
Guake.accel_increase_height
def accel_increase_height(self, *args): """Callback to increase height. """ height = self.settings.general.get_int('window-height') self.settings.general.set_int('window-height', min(height + 2, 100)) return True
python
def accel_increase_height(self, *args): """Callback to increase height. """ height = self.settings.general.get_int('window-height') self.settings.general.set_int('window-height', min(height + 2, 100)) return True
[ "def", "accel_increase_height", "(", "self", ",", "*", "args", ")", ":", "height", "=", "self", ".", "settings", ".", "general", ".", "get_int", "(", "'window-height'", ")", "self", ".", "settings", ".", "general", ".", "set_int", "(", "'window-height'", "...
Callback to increase height.
[ "Callback", "to", "increase", "height", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L780-L785
222,916
Guake/guake
guake/guake_app.py
Guake.accel_decrease_height
def accel_decrease_height(self, *args): """Callback to decrease height. """ height = self.settings.general.get_int('window-height') self.settings.general.set_int('window-height', max(height - 2, 0)) return True
python
def accel_decrease_height(self, *args): """Callback to decrease height. """ height = self.settings.general.get_int('window-height') self.settings.general.set_int('window-height', max(height - 2, 0)) return True
[ "def", "accel_decrease_height", "(", "self", ",", "*", "args", ")", ":", "height", "=", "self", ".", "settings", ".", "general", ".", "get_int", "(", "'window-height'", ")", "self", ".", "settings", ".", "general", ".", "set_int", "(", "'window-height'", "...
Callback to decrease height.
[ "Callback", "to", "decrease", "height", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L787-L792
222,917
Guake/guake
guake/guake_app.py
Guake.accel_increase_transparency
def accel_increase_transparency(self, *args): """Callback to increase transparency. """ transparency = self.settings.styleBackground.get_int('transparency') if int(transparency) - 2 > 0: self.settings.styleBackground.set_int('transparency', int(transparency) - 2) retu...
python
def accel_increase_transparency(self, *args): """Callback to increase transparency. """ transparency = self.settings.styleBackground.get_int('transparency') if int(transparency) - 2 > 0: self.settings.styleBackground.set_int('transparency', int(transparency) - 2) retu...
[ "def", "accel_increase_transparency", "(", "self", ",", "*", "args", ")", ":", "transparency", "=", "self", ".", "settings", ".", "styleBackground", ".", "get_int", "(", "'transparency'", ")", "if", "int", "(", "transparency", ")", "-", "2", ">", "0", ":",...
Callback to increase transparency.
[ "Callback", "to", "increase", "transparency", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L794-L800
222,918
Guake/guake
guake/guake_app.py
Guake.accel_decrease_transparency
def accel_decrease_transparency(self, *args): """Callback to decrease transparency. """ transparency = self.settings.styleBackground.get_int('transparency') if int(transparency) + 2 < MAX_TRANSPARENCY: self.settings.styleBackground.set_int('transparency', int(transparency) + ...
python
def accel_decrease_transparency(self, *args): """Callback to decrease transparency. """ transparency = self.settings.styleBackground.get_int('transparency') if int(transparency) + 2 < MAX_TRANSPARENCY: self.settings.styleBackground.set_int('transparency', int(transparency) + ...
[ "def", "accel_decrease_transparency", "(", "self", ",", "*", "args", ")", ":", "transparency", "=", "self", ".", "settings", ".", "styleBackground", ".", "get_int", "(", "'transparency'", ")", "if", "int", "(", "transparency", ")", "+", "2", "<", "MAX_TRANSP...
Callback to decrease transparency.
[ "Callback", "to", "decrease", "transparency", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L802-L808
222,919
Guake/guake
guake/guake_app.py
Guake.accel_toggle_transparency
def accel_toggle_transparency(self, *args): """Callback to toggle transparency. """ self.transparency_toggled = not self.transparency_toggled self.settings.styleBackground.triggerOnChangedValue( self.settings.styleBackground, 'transparency' ) return True
python
def accel_toggle_transparency(self, *args): """Callback to toggle transparency. """ self.transparency_toggled = not self.transparency_toggled self.settings.styleBackground.triggerOnChangedValue( self.settings.styleBackground, 'transparency' ) return True
[ "def", "accel_toggle_transparency", "(", "self", ",", "*", "args", ")", ":", "self", ".", "transparency_toggled", "=", "not", "self", ".", "transparency_toggled", "self", ".", "settings", ".", "styleBackground", ".", "triggerOnChangedValue", "(", "self", ".", "s...
Callback to toggle transparency.
[ "Callback", "to", "toggle", "transparency", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L810-L817
222,920
Guake/guake
guake/guake_app.py
Guake.accel_prev
def accel_prev(self, *args): """Callback to go to the previous tab. Called by the accel key. """ if self.get_notebook().get_current_page() == 0: self.get_notebook().set_current_page(self.get_notebook().get_n_pages() - 1) else: self.get_notebook().prev_page() ...
python
def accel_prev(self, *args): """Callback to go to the previous tab. Called by the accel key. """ if self.get_notebook().get_current_page() == 0: self.get_notebook().set_current_page(self.get_notebook().get_n_pages() - 1) else: self.get_notebook().prev_page() ...
[ "def", "accel_prev", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "get_notebook", "(", ")", ".", "get_current_page", "(", ")", "==", "0", ":", "self", ".", "get_notebook", "(", ")", ".", "set_current_page", "(", "self", ".", "get_noteboo...
Callback to go to the previous tab. Called by the accel key.
[ "Callback", "to", "go", "to", "the", "previous", "tab", ".", "Called", "by", "the", "accel", "key", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L831-L838
222,921
Guake/guake
guake/guake_app.py
Guake.accel_next
def accel_next(self, *args): """Callback to go to the next tab. Called by the accel key. """ if self.get_notebook().get_current_page() + 1 == self.get_notebook().get_n_pages(): self.get_notebook().set_current_page(0) else: self.get_notebook().next_page() r...
python
def accel_next(self, *args): """Callback to go to the next tab. Called by the accel key. """ if self.get_notebook().get_current_page() + 1 == self.get_notebook().get_n_pages(): self.get_notebook().set_current_page(0) else: self.get_notebook().next_page() r...
[ "def", "accel_next", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "get_notebook", "(", ")", ".", "get_current_page", "(", ")", "+", "1", "==", "self", ".", "get_notebook", "(", ")", ".", "get_n_pages", "(", ")", ":", "self", ".", "ge...
Callback to go to the next tab. Called by the accel key.
[ "Callback", "to", "go", "to", "the", "next", "tab", ".", "Called", "by", "the", "accel", "key", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L840-L847
222,922
Guake/guake
guake/guake_app.py
Guake.accel_move_tab_left
def accel_move_tab_left(self, *args): # TODO KEYBINDINGS ONLY """ Callback to move a tab to the left """ pos = self.get_notebook().get_current_page() if pos != 0: self.move_tab(pos, pos - 1) return True
python
def accel_move_tab_left(self, *args): # TODO KEYBINDINGS ONLY """ Callback to move a tab to the left """ pos = self.get_notebook().get_current_page() if pos != 0: self.move_tab(pos, pos - 1) return True
[ "def", "accel_move_tab_left", "(", "self", ",", "*", "args", ")", ":", "# TODO KEYBINDINGS ONLY", "pos", "=", "self", ".", "get_notebook", "(", ")", ".", "get_current_page", "(", ")", "if", "pos", "!=", "0", ":", "self", ".", "move_tab", "(", "pos", ",",...
Callback to move a tab to the left
[ "Callback", "to", "move", "a", "tab", "to", "the", "left" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L849-L855
222,923
Guake/guake
guake/guake_app.py
Guake.accel_move_tab_right
def accel_move_tab_right(self, *args): # TODO KEYBINDINGS ONLY """ Callback to move a tab to the right """ pos = self.get_notebook().get_current_page() if pos != self.get_notebook().get_n_pages() - 1: self.move_tab(pos, pos + 1) return True
python
def accel_move_tab_right(self, *args): # TODO KEYBINDINGS ONLY """ Callback to move a tab to the right """ pos = self.get_notebook().get_current_page() if pos != self.get_notebook().get_n_pages() - 1: self.move_tab(pos, pos + 1) return True
[ "def", "accel_move_tab_right", "(", "self", ",", "*", "args", ")", ":", "# TODO KEYBINDINGS ONLY", "pos", "=", "self", ".", "get_notebook", "(", ")", ".", "get_current_page", "(", ")", "if", "pos", "!=", "self", ".", "get_notebook", "(", ")", ".", "get_n_p...
Callback to move a tab to the right
[ "Callback", "to", "move", "a", "tab", "to", "the", "right" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L857-L863
222,924
Guake/guake
guake/guake_app.py
Guake.accel_rename_current_tab
def accel_rename_current_tab(self, *args): """Callback to show the rename tab dialog. Called by the accel key. """ page_num = self.get_notebook().get_current_page() page = self.get_notebook().get_nth_page(page_num) self.get_notebook().get_tab_label(page).on_rename(None) ...
python
def accel_rename_current_tab(self, *args): """Callback to show the rename tab dialog. Called by the accel key. """ page_num = self.get_notebook().get_current_page() page = self.get_notebook().get_nth_page(page_num) self.get_notebook().get_tab_label(page).on_rename(None) ...
[ "def", "accel_rename_current_tab", "(", "self", ",", "*", "args", ")", ":", "page_num", "=", "self", ".", "get_notebook", "(", ")", ".", "get_current_page", "(", ")", "page", "=", "self", ".", "get_notebook", "(", ")", ".", "get_nth_page", "(", "page_num",...
Callback to show the rename tab dialog. Called by the accel key.
[ "Callback", "to", "show", "the", "rename", "tab", "dialog", ".", "Called", "by", "the", "accel", "key", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L886-L893
222,925
Guake/guake
guake/guake_app.py
Guake.accel_toggle_hide_on_lose_focus
def accel_toggle_hide_on_lose_focus(self, *args): """Callback toggle whether the window should hide when it loses focus. Called by the accel key. """ if self.settings.general.get_boolean('window-losefocus'): self.settings.general.set_boolean('window-losefocus', False) ...
python
def accel_toggle_hide_on_lose_focus(self, *args): """Callback toggle whether the window should hide when it loses focus. Called by the accel key. """ if self.settings.general.get_boolean('window-losefocus'): self.settings.general.set_boolean('window-losefocus', False) ...
[ "def", "accel_toggle_hide_on_lose_focus", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "settings", ".", "general", ".", "get_boolean", "(", "'window-losefocus'", ")", ":", "self", ".", "settings", ".", "general", ".", "set_boolean", "(", "'win...
Callback toggle whether the window should hide when it loses focus. Called by the accel key.
[ "Callback", "toggle", "whether", "the", "window", "should", "hide", "when", "it", "loses", "focus", ".", "Called", "by", "the", "accel", "key", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L911-L919
222,926
Guake/guake
guake/guake_app.py
Guake.recompute_tabs_titles
def recompute_tabs_titles(self): """Updates labels on all tabs. This is required when `self.abbreviate` changes """ use_vte_titles = self.settings.general.get_boolean("use-vte-titles") if not use_vte_titles: return # TODO NOTEBOOK this code only works if ther...
python
def recompute_tabs_titles(self): """Updates labels on all tabs. This is required when `self.abbreviate` changes """ use_vte_titles = self.settings.general.get_boolean("use-vte-titles") if not use_vte_titles: return # TODO NOTEBOOK this code only works if ther...
[ "def", "recompute_tabs_titles", "(", "self", ")", ":", "use_vte_titles", "=", "self", ".", "settings", ".", "general", ".", "get_boolean", "(", "\"use-vte-titles\"", ")", "if", "not", "use_vte_titles", ":", "return", "# TODO NOTEBOOK this code only works if there is onl...
Updates labels on all tabs. This is required when `self.abbreviate` changes
[ "Updates", "labels", "on", "all", "tabs", ".", "This", "is", "required", "when", "self", ".", "abbreviate", "changes" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L933-L945
222,927
Guake/guake
guake/guake_app.py
Guake.compute_tab_title
def compute_tab_title(self, vte): """Abbreviate and cut vte terminal title when necessary """ vte_title = vte.get_window_title() or _("Terminal") try: current_directory = vte.get_current_directory() if self.abbreviate and vte_title.endswith(current_directory): ...
python
def compute_tab_title(self, vte): """Abbreviate and cut vte terminal title when necessary """ vte_title = vte.get_window_title() or _("Terminal") try: current_directory = vte.get_current_directory() if self.abbreviate and vte_title.endswith(current_directory): ...
[ "def", "compute_tab_title", "(", "self", ",", "vte", ")", ":", "vte_title", "=", "vte", ".", "get_window_title", "(", ")", "or", "_", "(", "\"Terminal\"", ")", "try", ":", "current_directory", "=", "vte", ".", "get_current_directory", "(", ")", "if", "self...
Abbreviate and cut vte terminal title when necessary
[ "Abbreviate", "and", "cut", "vte", "terminal", "title", "when", "necessary" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L947-L959
222,928
Guake/guake
guake/guake_app.py
Guake.close_tab
def close_tab(self, *args): """Closes the current tab. """ prompt_cfg = self.settings.general.get_int('prompt-on-close-tab') self.get_notebook().delete_page_current(prompt=prompt_cfg)
python
def close_tab(self, *args): """Closes the current tab. """ prompt_cfg = self.settings.general.get_int('prompt-on-close-tab') self.get_notebook().delete_page_current(prompt=prompt_cfg)
[ "def", "close_tab", "(", "self", ",", "*", "args", ")", ":", "prompt_cfg", "=", "self", ".", "settings", ".", "general", ".", "get_int", "(", "'prompt-on-close-tab'", ")", "self", ".", "get_notebook", "(", ")", ".", "delete_page_current", "(", "prompt", "=...
Closes the current tab.
[ "Closes", "the", "current", "tab", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L997-L1001
222,929
Guake/guake
guake/guake_app.py
Guake.rename_tab_uuid
def rename_tab_uuid(self, term_uuid, new_text, user_set=True): """Rename an already added tab by its UUID """ term_uuid = uuid.UUID(term_uuid) page_index, = ( index for index, t in enumerate(self.get_notebook().iter_terminals()) if t.get_uuid() == term_uuid ...
python
def rename_tab_uuid(self, term_uuid, new_text, user_set=True): """Rename an already added tab by its UUID """ term_uuid = uuid.UUID(term_uuid) page_index, = ( index for index, t in enumerate(self.get_notebook().iter_terminals()) if t.get_uuid() == term_uuid ...
[ "def", "rename_tab_uuid", "(", "self", ",", "term_uuid", ",", "new_text", ",", "user_set", "=", "True", ")", ":", "term_uuid", "=", "uuid", ".", "UUID", "(", "term_uuid", ")", "page_index", ",", "=", "(", "index", "for", "index", ",", "t", "in", "enume...
Rename an already added tab by its UUID
[ "Rename", "an", "already", "added", "tab", "by", "its", "UUID" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L1003-L1011
222,930
Guake/guake
guake/guake_app.py
Guake.get_selected_uuidtab
def get_selected_uuidtab(self): # TODO DBUS ONLY """Returns the uuid of the current selected terminal """ page_num = self.get_notebook().get_current_page() terminals = self.get_notebook().get_terminals_for_page(page_num) return str(terminals[0].get_uuid())
python
def get_selected_uuidtab(self): # TODO DBUS ONLY """Returns the uuid of the current selected terminal """ page_num = self.get_notebook().get_current_page() terminals = self.get_notebook().get_terminals_for_page(page_num) return str(terminals[0].get_uuid())
[ "def", "get_selected_uuidtab", "(", "self", ")", ":", "# TODO DBUS ONLY", "page_num", "=", "self", ".", "get_notebook", "(", ")", ".", "get_current_page", "(", ")", "terminals", "=", "self", ".", "get_notebook", "(", ")", ".", "get_terminals_for_page", "(", "p...
Returns the uuid of the current selected terminal
[ "Returns", "the", "uuid", "of", "the", "current", "selected", "terminal" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L1093-L1099
222,931
Guake/guake
guake/guake_app.py
Guake.search_on_web
def search_on_web(self, *args): """Search for the selected text on the web """ # TODO KEYBINDINGS ONLY current_term = self.get_notebook().get_current_terminal() if current_term.get_has_selection(): current_term.copy_clipboard() guake_clipboard = Gtk.Clipb...
python
def search_on_web(self, *args): """Search for the selected text on the web """ # TODO KEYBINDINGS ONLY current_term = self.get_notebook().get_current_terminal() if current_term.get_has_selection(): current_term.copy_clipboard() guake_clipboard = Gtk.Clipb...
[ "def", "search_on_web", "(", "self", ",", "*", "args", ")", ":", "# TODO KEYBINDINGS ONLY", "current_term", "=", "self", ".", "get_notebook", "(", ")", ".", "get_current_terminal", "(", ")", "if", "current_term", ".", "get_has_selection", "(", ")", ":", "curre...
Search for the selected text on the web
[ "Search", "for", "the", "selected", "text", "on", "the", "web" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L1101-L1117
222,932
Guake/guake
guake/guake_app.py
Guake.execute_hook
def execute_hook(self, event_name): """Execute shell commands related to current event_name""" hook = self.settings.hooks.get_string('{!s}'.format(event_name)) if hook is not None and hook != "": hook = hook.split() try: subprocess.Popen(hook) ...
python
def execute_hook(self, event_name): """Execute shell commands related to current event_name""" hook = self.settings.hooks.get_string('{!s}'.format(event_name)) if hook is not None and hook != "": hook = hook.split() try: subprocess.Popen(hook) ...
[ "def", "execute_hook", "(", "self", ",", "event_name", ")", ":", "hook", "=", "self", ".", "settings", ".", "hooks", ".", "get_string", "(", "'{!s}'", ".", "format", "(", "event_name", ")", ")", "if", "hook", "is", "not", "None", "and", "hook", "!=", ...
Execute shell commands related to current event_name
[ "Execute", "shell", "commands", "related", "to", "current", "event_name" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/guake_app.py#L1125-L1142
222,933
Guake/guake
guake/theme.py
get_resource_dirs
def get_resource_dirs(resource): """Returns a list of all known resource dirs for a given resource. :param str resource: Name of the resource (e.g. "themes") :return: A list of resource dirs """ dirs = [ os.path.join(dir, resource) for dir in itertools.chain(GLib.get...
python
def get_resource_dirs(resource): """Returns a list of all known resource dirs for a given resource. :param str resource: Name of the resource (e.g. "themes") :return: A list of resource dirs """ dirs = [ os.path.join(dir, resource) for dir in itertools.chain(GLib.get...
[ "def", "get_resource_dirs", "(", "resource", ")", ":", "dirs", "=", "[", "os", ".", "path", ".", "join", "(", "dir", ",", "resource", ")", "for", "dir", "in", "itertools", ".", "chain", "(", "GLib", ".", "get_system_data_dirs", "(", ")", ",", "GUAKE_TH...
Returns a list of all known resource dirs for a given resource. :param str resource: Name of the resource (e.g. "themes") :return: A list of resource dirs
[ "Returns", "a", "list", "of", "all", "known", "resource", "dirs", "for", "a", "given", "resource", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/theme.py#L22-L36
222,934
Guake/guake
guake/terminal.py
GuakeTerminal.configure_terminal
def configure_terminal(self): """Sets all customized properties on the terminal """ client = self.guake.settings.general word_chars = client.get_string('word-chars') if word_chars: self.set_word_char_exceptions(word_chars) self.set_audible_bell(client.get_bool...
python
def configure_terminal(self): """Sets all customized properties on the terminal """ client = self.guake.settings.general word_chars = client.get_string('word-chars') if word_chars: self.set_word_char_exceptions(word_chars) self.set_audible_bell(client.get_bool...
[ "def", "configure_terminal", "(", "self", ")", ":", "client", "=", "self", ".", "guake", ".", "settings", ".", "general", "word_chars", "=", "client", ".", "get_string", "(", "'word-chars'", ")", "if", "word_chars", ":", "self", ".", "set_word_char_exceptions"...
Sets all customized properties on the terminal
[ "Sets", "all", "customized", "properties", "on", "the", "terminal" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/terminal.py#L143-L172
222,935
Guake/guake
guake/terminal.py
GuakeTerminal.is_file_on_local_server
def is_file_on_local_server(self, text) -> Tuple[Optional[Path], Optional[int], Optional[int]]: """Test if the provided text matches a file on local server Supports: - absolute path - relative path (using current working directory) - file:line syntax - file:line:colu...
python
def is_file_on_local_server(self, text) -> Tuple[Optional[Path], Optional[int], Optional[int]]: """Test if the provided text matches a file on local server Supports: - absolute path - relative path (using current working directory) - file:line syntax - file:line:colu...
[ "def", "is_file_on_local_server", "(", "self", ",", "text", ")", "->", "Tuple", "[", "Optional", "[", "Path", "]", ",", "Optional", "[", "int", "]", ",", "Optional", "[", "int", "]", "]", ":", "lineno", "=", "None", "colno", "=", "None", "py_func", "...
Test if the provided text matches a file on local server Supports: - absolute path - relative path (using current working directory) - file:line syntax - file:line:colum syntax Args: text (str): candidate for file search Returns - Tu...
[ "Test", "if", "the", "provided", "text", "matches", "a", "file", "on", "local", "server" ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/terminal.py#L226-L297
222,936
Guake/guake
guake/terminal.py
GuakeTerminal.button_press
def button_press(self, terminal, event): """Handles the button press event in the terminal widget. If any match string is caught, another application is open to handle the matched resource uri. """ self.matched_value = '' if (Vte.MAJOR_VERSION, Vte.MINOR_VERSION) >= (0, 4...
python
def button_press(self, terminal, event): """Handles the button press event in the terminal widget. If any match string is caught, another application is open to handle the matched resource uri. """ self.matched_value = '' if (Vte.MAJOR_VERSION, Vte.MINOR_VERSION) >= (0, 4...
[ "def", "button_press", "(", "self", ",", "terminal", ",", "event", ")", ":", "self", ".", "matched_value", "=", "''", "if", "(", "Vte", ".", "MAJOR_VERSION", ",", "Vte", ".", "MINOR_VERSION", ")", ">=", "(", "0", ",", "46", ")", ":", "matched_string", ...
Handles the button press event in the terminal widget. If any match string is caught, another application is open to handle the matched resource uri.
[ "Handles", "the", "button", "press", "event", "in", "the", "terminal", "widget", ".", "If", "any", "match", "string", "is", "caught", "another", "application", "is", "open", "to", "handle", "the", "matched", "resource", "uri", "." ]
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/terminal.py#L299-L327
222,937
Guake/guake
guake/terminal.py
GuakeTerminal.delete_shell
def delete_shell(self, pid): """This function will kill the shell on a tab, trying to send a sigterm and if it doesn't work, a sigkill. Between these two signals, we have a timeout of 3 seconds, so is recommended to call this in another thread. This doesn't change any thing in UI...
python
def delete_shell(self, pid): """This function will kill the shell on a tab, trying to send a sigterm and if it doesn't work, a sigkill. Between these two signals, we have a timeout of 3 seconds, so is recommended to call this in another thread. This doesn't change any thing in UI...
[ "def", "delete_shell", "(", "self", ",", "pid", ")", ":", "try", ":", "os", ".", "kill", "(", "pid", ",", "signal", ".", "SIGHUP", ")", "except", "OSError", ":", "pass", "num_tries", "=", "30", "while", "num_tries", ">", "0", ":", "try", ":", "# Tr...
This function will kill the shell on a tab, trying to send a sigterm and if it doesn't work, a sigkill. Between these two signals, we have a timeout of 3 seconds, so is recommended to call this in another thread. This doesn't change any thing in UI, so you can use python's start_new_thre...
[ "This", "function", "will", "kill", "the", "shell", "on", "a", "tab", "trying", "to", "send", "a", "sigterm", "and", "if", "it", "doesn", "t", "work", "a", "sigkill", ".", "Between", "these", "two", "signals", "we", "have", "a", "timeout", "of", "3", ...
4153ef38f9044cbed6494075fce80acd5809df2b
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/terminal.py#L463-L495
222,938
graphql-python/graphql-core
graphql/utils/is_valid_value.py
is_valid_value
def is_valid_value(value, type): # type: (Any, Any) -> List """Given a type and any value, return True if that value is valid.""" if isinstance(type, GraphQLNonNull): of_type = type.of_type if value is None: return [u'Expected "{}", found null.'.format(type)] return is_v...
python
def is_valid_value(value, type): # type: (Any, Any) -> List """Given a type and any value, return True if that value is valid.""" if isinstance(type, GraphQLNonNull): of_type = type.of_type if value is None: return [u'Expected "{}", found null.'.format(type)] return is_v...
[ "def", "is_valid_value", "(", "value", ",", "type", ")", ":", "# type: (Any, Any) -> List", "if", "isinstance", "(", "type", ",", "GraphQLNonNull", ")", ":", "of_type", "=", "type", ".", "of_type", "if", "value", "is", "None", ":", "return", "[", "u'Expected...
Given a type and any value, return True if that value is valid.
[ "Given", "a", "type", "and", "any", "value", "return", "True", "if", "that", "value", "is", "valid", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/utils/is_valid_value.py#L28-L82
222,939
graphql-python/graphql-core
graphql/backend/cache.py
get_unique_schema_id
def get_unique_schema_id(schema): # type: (GraphQLSchema) -> str """Get a unique id given a GraphQLSchema""" assert isinstance(schema, GraphQLSchema), ( "Must receive a GraphQLSchema as schema. Received {}" ).format(repr(schema)) if schema not in _cached_schemas: _cached_schemas[sch...
python
def get_unique_schema_id(schema): # type: (GraphQLSchema) -> str """Get a unique id given a GraphQLSchema""" assert isinstance(schema, GraphQLSchema), ( "Must receive a GraphQLSchema as schema. Received {}" ).format(repr(schema)) if schema not in _cached_schemas: _cached_schemas[sch...
[ "def", "get_unique_schema_id", "(", "schema", ")", ":", "# type: (GraphQLSchema) -> str", "assert", "isinstance", "(", "schema", ",", "GraphQLSchema", ")", ",", "(", "\"Must receive a GraphQLSchema as schema. Received {}\"", ")", ".", "format", "(", "repr", "(", "schema...
Get a unique id given a GraphQLSchema
[ "Get", "a", "unique", "id", "given", "a", "GraphQLSchema" ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/backend/cache.py#L18-L27
222,940
graphql-python/graphql-core
graphql/backend/cache.py
get_unique_document_id
def get_unique_document_id(query_str): # type: (str) -> str """Get a unique id given a query_string""" assert isinstance(query_str, string_types), ( "Must receive a string as query_str. Received {}" ).format(repr(query_str)) if query_str not in _cached_queries: _cached_queries[query...
python
def get_unique_document_id(query_str): # type: (str) -> str """Get a unique id given a query_string""" assert isinstance(query_str, string_types), ( "Must receive a string as query_str. Received {}" ).format(repr(query_str)) if query_str not in _cached_queries: _cached_queries[query...
[ "def", "get_unique_document_id", "(", "query_str", ")", ":", "# type: (str) -> str", "assert", "isinstance", "(", "query_str", ",", "string_types", ")", ",", "(", "\"Must receive a string as query_str. Received {}\"", ")", ".", "format", "(", "repr", "(", "query_str", ...
Get a unique id given a query_string
[ "Get", "a", "unique", "id", "given", "a", "query_string" ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/backend/cache.py#L30-L39
222,941
graphql-python/graphql-core
graphql/backend/cache.py
GraphQLCachedBackend.get_key_for_schema_and_document_string
def get_key_for_schema_and_document_string(self, schema, request_string): # type: (GraphQLSchema, str) -> int """This method returns a unique key given a schema and a request_string""" if self.use_consistent_hash: schema_id = get_unique_schema_id(schema) document_id = get...
python
def get_key_for_schema_and_document_string(self, schema, request_string): # type: (GraphQLSchema, str) -> int """This method returns a unique key given a schema and a request_string""" if self.use_consistent_hash: schema_id = get_unique_schema_id(schema) document_id = get...
[ "def", "get_key_for_schema_and_document_string", "(", "self", ",", "schema", ",", "request_string", ")", ":", "# type: (GraphQLSchema, str) -> int", "if", "self", ".", "use_consistent_hash", ":", "schema_id", "=", "get_unique_schema_id", "(", "schema", ")", "document_id",...
This method returns a unique key given a schema and a request_string
[ "This", "method", "returns", "a", "unique", "key", "given", "a", "schema", "and", "a", "request_string" ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/backend/cache.py#L62-L69
222,942
graphql-python/graphql-core
graphql/validation/rules/fields_on_correct_type.py
get_suggested_type_names
def get_suggested_type_names(schema, output_type, field_name): """Go through all of the implementations of type, as well as the interfaces that they implement. If any of those types include the provided field, suggest them, sorted by how often the type is referenced, starting with Interfaces.""" ...
python
def get_suggested_type_names(schema, output_type, field_name): """Go through all of the implementations of type, as well as the interfaces that they implement. If any of those types include the provided field, suggest them, sorted by how often the type is referenced, starting with Interfaces.""" ...
[ "def", "get_suggested_type_names", "(", "schema", ",", "output_type", ",", "field_name", ")", ":", "if", "isinstance", "(", "output_type", ",", "(", "GraphQLInterfaceType", ",", "GraphQLUnionType", ")", ")", ":", "suggested_object_types", "=", "[", "]", "interface...
Go through all of the implementations of type, as well as the interfaces that they implement. If any of those types include the provided field, suggest them, sorted by how often the type is referenced, starting with Interfaces.
[ "Go", "through", "all", "of", "the", "implementations", "of", "type", "as", "well", "as", "the", "interfaces", "that", "they", "implement", ".", "If", "any", "of", "those", "types", "include", "the", "provided", "field", "suggest", "them", "sorted", "by", ...
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/validation/rules/fields_on_correct_type.py#L91-L128
222,943
graphql-python/graphql-core
graphql/validation/rules/fields_on_correct_type.py
get_suggested_field_names
def get_suggested_field_names(schema, graphql_type, field_name): """For the field name provided, determine if there are any similar field names that may be the result of a typo.""" if isinstance(graphql_type, (GraphQLInterfaceType, GraphQLObjectType)): possible_field_names = list(graphql_type.field...
python
def get_suggested_field_names(schema, graphql_type, field_name): """For the field name provided, determine if there are any similar field names that may be the result of a typo.""" if isinstance(graphql_type, (GraphQLInterfaceType, GraphQLObjectType)): possible_field_names = list(graphql_type.field...
[ "def", "get_suggested_field_names", "(", "schema", ",", "graphql_type", ",", "field_name", ")", ":", "if", "isinstance", "(", "graphql_type", ",", "(", "GraphQLInterfaceType", ",", "GraphQLObjectType", ")", ")", ":", "possible_field_names", "=", "list", "(", "grap...
For the field name provided, determine if there are any similar field names that may be the result of a typo.
[ "For", "the", "field", "name", "provided", "determine", "if", "there", "are", "any", "similar", "field", "names", "that", "may", "be", "the", "result", "of", "a", "typo", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/validation/rules/fields_on_correct_type.py#L131-L141
222,944
graphql-python/graphql-core
graphql/backend/compiled.py
GraphQLCompiledDocument.from_code
def from_code( cls, schema, # type: GraphQLSchema code, # type: Union[str, Any] uptodate=None, # type: Optional[bool] extra_namespace=None, # type: Optional[Dict[str, Any]] ): # type: (...) -> GraphQLCompiledDocument """Creates a GraphQLDocument object fro...
python
def from_code( cls, schema, # type: GraphQLSchema code, # type: Union[str, Any] uptodate=None, # type: Optional[bool] extra_namespace=None, # type: Optional[Dict[str, Any]] ): # type: (...) -> GraphQLCompiledDocument """Creates a GraphQLDocument object fro...
[ "def", "from_code", "(", "cls", ",", "schema", ",", "# type: GraphQLSchema", "code", ",", "# type: Union[str, Any]", "uptodate", "=", "None", ",", "# type: Optional[bool]", "extra_namespace", "=", "None", ",", "# type: Optional[Dict[str, Any]]", ")", ":", "# type: (...)...
Creates a GraphQLDocument object from compiled code and the globals. This is used by the loaders and schema to create a document object.
[ "Creates", "a", "GraphQLDocument", "object", "from", "compiled", "code", "and", "the", "globals", ".", "This", "is", "used", "by", "the", "loaders", "and", "schema", "to", "create", "a", "document", "object", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/backend/compiled.py#L12-L32
222,945
graphql-python/graphql-core
graphql/utils/suggestion_list.py
suggestion_list
def suggestion_list(inp, options): """ Given an invalid input string and a list of valid options, returns a filtered list of valid options sorted based on their similarity with the input. """ options_by_distance = OrderedDict() input_threshold = len(inp) / 2 for option in options: ...
python
def suggestion_list(inp, options): """ Given an invalid input string and a list of valid options, returns a filtered list of valid options sorted based on their similarity with the input. """ options_by_distance = OrderedDict() input_threshold = len(inp) / 2 for option in options: ...
[ "def", "suggestion_list", "(", "inp", ",", "options", ")", ":", "options_by_distance", "=", "OrderedDict", "(", ")", "input_threshold", "=", "len", "(", "inp", ")", "/", "2", "for", "option", "in", "options", ":", "distance", "=", "lexical_distance", "(", ...
Given an invalid input string and a list of valid options, returns a filtered list of valid options sorted based on their similarity with the input.
[ "Given", "an", "invalid", "input", "string", "and", "a", "list", "of", "valid", "options", "returns", "a", "filtered", "list", "of", "valid", "options", "sorted", "based", "on", "their", "similarity", "with", "the", "input", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/utils/suggestion_list.py#L4-L20
222,946
graphql-python/graphql-core
graphql/utils/suggestion_list.py
lexical_distance
def lexical_distance(a, b): """ Computes the lexical distance between strings A and B. The "distance" between two strings is given by counting the minimum number of edits needed to transform string A into string B. An edit can be an insertion, deletion, or substitution of a single character, or ...
python
def lexical_distance(a, b): """ Computes the lexical distance between strings A and B. The "distance" between two strings is given by counting the minimum number of edits needed to transform string A into string B. An edit can be an insertion, deletion, or substitution of a single character, or ...
[ "def", "lexical_distance", "(", "a", ",", "b", ")", ":", "d", "=", "[", "[", "i", "]", "for", "i", "in", "range", "(", "len", "(", "a", ")", "+", "1", ")", "]", "or", "[", "]", "d_len", "=", "len", "(", "d", ")", "or", "1", "for", "i", ...
Computes the lexical distance between strings A and B. The "distance" between two strings is given by counting the minimum number of edits needed to transform string A into string B. An edit can be an insertion, deletion, or substitution of a single character, or a swap of two adjacent characters. ...
[ "Computes", "the", "lexical", "distance", "between", "strings", "A", "and", "B", ".", "The", "distance", "between", "two", "strings", "is", "given", "by", "counting", "the", "minimum", "number", "of", "edits", "needed", "to", "transform", "string", "A", "int...
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/utils/suggestion_list.py#L23-L52
222,947
graphql-python/graphql-core
graphql/pyutils/version.py
get_complete_version
def get_complete_version(version=None): """Returns a tuple of the graphql version. If version argument is non-empty, then checks for correctness of the tuple provided. """ if version is None: from graphql import VERSION as version else: assert len(version) == 5 assert version...
python
def get_complete_version(version=None): """Returns a tuple of the graphql version. If version argument is non-empty, then checks for correctness of the tuple provided. """ if version is None: from graphql import VERSION as version else: assert len(version) == 5 assert version...
[ "def", "get_complete_version", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "from", "graphql", "import", "VERSION", "as", "version", "else", ":", "assert", "len", "(", "version", ")", "==", "5", "assert", "version", "[", "3"...
Returns a tuple of the graphql version. If version argument is non-empty, then checks for correctness of the tuple provided.
[ "Returns", "a", "tuple", "of", "the", "graphql", "version", ".", "If", "version", "argument", "is", "non", "-", "empty", "then", "checks", "for", "correctness", "of", "the", "tuple", "provided", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/pyutils/version.py#L40-L50
222,948
graphql-python/graphql-core
graphql/language/lexer.py
read_token
def read_token(source, from_position): # type: (Source, int) -> Token """Gets the next token from the source starting at the given position. This skips over whitespace and comments until it finds the next lexable token, then lexes punctuators immediately or calls the appropriate helper fucntion for...
python
def read_token(source, from_position): # type: (Source, int) -> Token """Gets the next token from the source starting at the given position. This skips over whitespace and comments until it finds the next lexable token, then lexes punctuators immediately or calls the appropriate helper fucntion for...
[ "def", "read_token", "(", "source", ",", "from_position", ")", ":", "# type: (Source, int) -> Token", "body", "=", "source", ".", "body", "body_length", "=", "len", "(", "body", ")", "position", "=", "position_after_whitespace", "(", "body", ",", "from_position", ...
Gets the next token from the source starting at the given position. This skips over whitespace and comments until it finds the next lexable token, then lexes punctuators immediately or calls the appropriate helper fucntion for more complicated tokens.
[ "Gets", "the", "next", "token", "from", "the", "source", "starting", "at", "the", "given", "position", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/lexer.py#L152-L198
222,949
graphql-python/graphql-core
graphql/language/lexer.py
position_after_whitespace
def position_after_whitespace(body, start_position): # type: (str, int) -> int """Reads from body starting at start_position until it finds a non-whitespace or commented character, then returns the position of that character for lexing.""" body_length = len(body) position = start_position wh...
python
def position_after_whitespace(body, start_position): # type: (str, int) -> int """Reads from body starting at start_position until it finds a non-whitespace or commented character, then returns the position of that character for lexing.""" body_length = len(body) position = start_position wh...
[ "def", "position_after_whitespace", "(", "body", ",", "start_position", ")", ":", "# type: (str, int) -> int", "body_length", "=", "len", "(", "body", ")", "position", "=", "start_position", "while", "position", "<", "body_length", ":", "code", "=", "char_code_at", ...
Reads from body starting at start_position until it finds a non-whitespace or commented character, then returns the position of that character for lexing.
[ "Reads", "from", "body", "starting", "at", "start_position", "until", "it", "finds", "a", "non", "-", "whitespace", "or", "commented", "character", "then", "returns", "the", "position", "of", "that", "character", "for", "lexing", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/lexer.py#L217-L243
222,950
graphql-python/graphql-core
graphql/language/lexer.py
read_number
def read_number(source, start, first_code): # type: (Source, int, Optional[int]) -> Token r"""Reads a number token from the source file, either a float or an int depending on whether a decimal point appears. Int: -?(0|[1-9][0-9]*) Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)?""" cod...
python
def read_number(source, start, first_code): # type: (Source, int, Optional[int]) -> Token r"""Reads a number token from the source file, either a float or an int depending on whether a decimal point appears. Int: -?(0|[1-9][0-9]*) Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)?""" cod...
[ "def", "read_number", "(", "source", ",", "start", ",", "first_code", ")", ":", "# type: (Source, int, Optional[int]) -> Token", "code", "=", "first_code", "body", "=", "source", ".", "body", "position", "=", "start", "is_float", "=", "False", "if", "code", "=="...
r"""Reads a number token from the source file, either a float or an int depending on whether a decimal point appears. Int: -?(0|[1-9][0-9]*) Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)?
[ "r", "Reads", "a", "number", "token", "from", "the", "source", "file", "either", "a", "float", "or", "an", "int", "depending", "on", "whether", "a", "decimal", "point", "appears", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/lexer.py#L246-L301
222,951
graphql-python/graphql-core
graphql/language/lexer.py
read_string
def read_string(source, start): # type: (Source, int) -> Token """Reads a string token from the source file. "([^"\\\u000A\u000D\u2028\u2029]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" """ body = source.body body_length = len(body) position = start + 1 chunk_start = position code = 0 # ...
python
def read_string(source, start): # type: (Source, int) -> Token """Reads a string token from the source file. "([^"\\\u000A\u000D\u2028\u2029]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" """ body = source.body body_length = len(body) position = start + 1 chunk_start = position code = 0 # ...
[ "def", "read_string", "(", "source", ",", "start", ")", ":", "# type: (Source, int) -> Token", "body", "=", "source", ".", "body", "body_length", "=", "len", "(", "body", ")", "position", "=", "start", "+", "1", "chunk_start", "=", "position", "code", "=", ...
Reads a string token from the source file. "([^"\\\u000A\u000D\u2028\u2029]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*"
[ "Reads", "a", "string", "token", "from", "the", "source", "file", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/lexer.py#L339-L417
222,952
graphql-python/graphql-core
graphql/language/lexer.py
read_name
def read_name(source, position): # type: (Source, int) -> Token """Reads an alphanumeric + underscore name from the source. [_A-Za-z][_0-9A-Za-z]*""" body = source.body body_length = len(body) end = position + 1 while end != body_length: code = char_code_at(body, end) if no...
python
def read_name(source, position): # type: (Source, int) -> Token """Reads an alphanumeric + underscore name from the source. [_A-Za-z][_0-9A-Za-z]*""" body = source.body body_length = len(body) end = position + 1 while end != body_length: code = char_code_at(body, end) if no...
[ "def", "read_name", "(", "source", ",", "position", ")", ":", "# type: (Source, int) -> Token", "body", "=", "source", ".", "body", "body_length", "=", "len", "(", "body", ")", "end", "=", "position", "+", "1", "while", "end", "!=", "body_length", ":", "co...
Reads an alphanumeric + underscore name from the source. [_A-Za-z][_0-9A-Za-z]*
[ "Reads", "an", "alphanumeric", "+", "underscore", "name", "from", "the", "source", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/lexer.py#L451-L475
222,953
graphql-python/graphql-core
graphql/execution/executor.py
complete_value
def complete_value( exe_context, # type: ExecutionContext return_type, # type: Any field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Any """ Implements the instructions for completeValue as defi...
python
def complete_value( exe_context, # type: ExecutionContext return_type, # type: Any field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Any """ Implements the instructions for completeValue as defi...
[ "def", "complete_value", "(", "exe_context", ",", "# type: ExecutionContext", "return_type", ",", "# type: Any", "field_asts", ",", "# type: List[Field]", "info", ",", "# type: ResolveInfo", "path", ",", "# type: List[Union[int, str]]", "result", ",", "# type: Any", ")", ...
Implements the instructions for completeValue as defined in the "Field entries" section of the spec. If the field type is Non-Null, then this recursively completes the value for the inner type. It throws a field error if that completion returns null, as per the "Nullability" section of the spec. If th...
[ "Implements", "the", "instructions", "for", "completeValue", "as", "defined", "in", "the", "Field", "entries", "section", "of", "the", "spec", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/executor.py#L498-L571
222,954
graphql-python/graphql-core
graphql/execution/executor.py
complete_list_value
def complete_list_value( exe_context, # type: ExecutionContext return_type, # type: GraphQLList field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> List[Any] """ Complete a list value by completin...
python
def complete_list_value( exe_context, # type: ExecutionContext return_type, # type: GraphQLList field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> List[Any] """ Complete a list value by completin...
[ "def", "complete_list_value", "(", "exe_context", ",", "# type: ExecutionContext", "return_type", ",", "# type: GraphQLList", "field_asts", ",", "# type: List[Field]", "info", ",", "# type: ResolveInfo", "path", ",", "# type: List[Union[int, str]]", "result", ",", "# type: An...
Complete a list value by completing each item in the list with the inner type
[ "Complete", "a", "list", "value", "by", "completing", "each", "item", "in", "the", "list", "with", "the", "inner", "type" ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/executor.py#L574-L605
222,955
graphql-python/graphql-core
graphql/execution/executor.py
complete_leaf_value
def complete_leaf_value( return_type, # type: Union[GraphQLEnumType, GraphQLScalarType] path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Union[int, str, float, bool] """ Complete a Scalar or Enum by serializing to a valid value, returning null if serialization is no...
python
def complete_leaf_value( return_type, # type: Union[GraphQLEnumType, GraphQLScalarType] path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Union[int, str, float, bool] """ Complete a Scalar or Enum by serializing to a valid value, returning null if serialization is no...
[ "def", "complete_leaf_value", "(", "return_type", ",", "# type: Union[GraphQLEnumType, GraphQLScalarType]", "path", ",", "# type: List[Union[int, str]]", "result", ",", "# type: Any", ")", ":", "# type: (...) -> Union[int, str, float, bool]", "assert", "hasattr", "(", "return_typ...
Complete a Scalar or Enum by serializing to a valid value, returning null if serialization is not possible.
[ "Complete", "a", "Scalar", "or", "Enum", "by", "serializing", "to", "a", "valid", "value", "returning", "null", "if", "serialization", "is", "not", "possible", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/executor.py#L608-L627
222,956
graphql-python/graphql-core
graphql/execution/executor.py
complete_abstract_value
def complete_abstract_value( exe_context, # type: ExecutionContext return_type, # type: Union[GraphQLInterfaceType, GraphQLUnionType] field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Dict[str, Any] ...
python
def complete_abstract_value( exe_context, # type: ExecutionContext return_type, # type: Union[GraphQLInterfaceType, GraphQLUnionType] field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Dict[str, Any] ...
[ "def", "complete_abstract_value", "(", "exe_context", ",", "# type: ExecutionContext", "return_type", ",", "# type: Union[GraphQLInterfaceType, GraphQLUnionType]", "field_asts", ",", "# type: List[Field]", "info", ",", "# type: ResolveInfo", "path", ",", "# type: List[Union[int, st...
Complete an value of an abstract type by determining the runtime type of that value, then completing based on that type.
[ "Complete", "an", "value", "of", "an", "abstract", "type", "by", "determining", "the", "runtime", "type", "of", "that", "value", "then", "completing", "based", "on", "that", "type", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/executor.py#L630-L676
222,957
graphql-python/graphql-core
graphql/execution/executor.py
complete_object_value
def complete_object_value( exe_context, # type: ExecutionContext return_type, # type: GraphQLObjectType field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Dict[str, Any] """ Complete an Object va...
python
def complete_object_value( exe_context, # type: ExecutionContext return_type, # type: GraphQLObjectType field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Dict[str, Any] """ Complete an Object va...
[ "def", "complete_object_value", "(", "exe_context", ",", "# type: ExecutionContext", "return_type", ",", "# type: GraphQLObjectType", "field_asts", ",", "# type: List[Field]", "info", ",", "# type: ResolveInfo", "path", ",", "# type: List[Union[int, str]]", "result", ",", "# ...
Complete an Object value by evaluating all sub-selections.
[ "Complete", "an", "Object", "value", "by", "evaluating", "all", "sub", "-", "selections", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/executor.py#L692-L714
222,958
graphql-python/graphql-core
graphql/execution/executor.py
complete_nonnull_value
def complete_nonnull_value( exe_context, # type: ExecutionContext return_type, # type: GraphQLNonNull field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Any """ Complete a NonNull value by comple...
python
def complete_nonnull_value( exe_context, # type: ExecutionContext return_type, # type: GraphQLNonNull field_asts, # type: List[Field] info, # type: ResolveInfo path, # type: List[Union[int, str]] result, # type: Any ): # type: (...) -> Any """ Complete a NonNull value by comple...
[ "def", "complete_nonnull_value", "(", "exe_context", ",", "# type: ExecutionContext", "return_type", ",", "# type: GraphQLNonNull", "field_asts", ",", "# type: List[Field]", "info", ",", "# type: ResolveInfo", "path", ",", "# type: List[Union[int, str]]", "result", ",", "# ty...
Complete a NonNull value by completing the inner type
[ "Complete", "a", "NonNull", "value", "by", "completing", "the", "inner", "type" ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/executor.py#L717-L741
222,959
graphql-python/graphql-core
graphql/utils/value_from_ast.py
value_from_ast
def value_from_ast(value_ast, type, variables=None): # type: (Optional[Node], GraphQLType, Optional[Dict[str, Union[List, Dict, int, float, bool, str, None]]]) -> Union[List, Dict, int, float, bool, str, None] """Given a type and a value AST node known to match this type, build a runtime value.""" if is...
python
def value_from_ast(value_ast, type, variables=None): # type: (Optional[Node], GraphQLType, Optional[Dict[str, Union[List, Dict, int, float, bool, str, None]]]) -> Union[List, Dict, int, float, bool, str, None] """Given a type and a value AST node known to match this type, build a runtime value.""" if is...
[ "def", "value_from_ast", "(", "value_ast", ",", "type", ",", "variables", "=", "None", ")", ":", "# type: (Optional[Node], GraphQLType, Optional[Dict[str, Union[List, Dict, int, float, bool, str, None]]]) -> Union[List, Dict, int, float, bool, str, None]", "if", "isinstance", "(", "t...
Given a type and a value AST node known to match this type, build a runtime value.
[ "Given", "a", "type", "and", "a", "value", "AST", "node", "known", "to", "match", "this", "type", "build", "a", "runtime", "value", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/utils/value_from_ast.py#L17-L81
222,960
graphql-python/graphql-core
graphql/utils/ast_to_code.py
ast_to_code
def ast_to_code(ast, indent=0): # type: (Any, int) -> str """ Converts an ast into a python code representation of the AST. """ code = [] def append(line): # type: (str) -> None code.append((" " * indent) + line) if isinstance(ast, Node): append("ast.{}(".format(...
python
def ast_to_code(ast, indent=0): # type: (Any, int) -> str """ Converts an ast into a python code representation of the AST. """ code = [] def append(line): # type: (str) -> None code.append((" " * indent) + line) if isinstance(ast, Node): append("ast.{}(".format(...
[ "def", "ast_to_code", "(", "ast", ",", "indent", "=", "0", ")", ":", "# type: (Any, int) -> str", "code", "=", "[", "]", "def", "append", "(", "line", ")", ":", "# type: (str) -> None", "code", ".", "append", "(", "(", "\" \"", "*", "indent", ")", "+"...
Converts an ast into a python code representation of the AST.
[ "Converts", "an", "ast", "into", "a", "python", "code", "representation", "of", "the", "AST", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/utils/ast_to_code.py#L9-L52
222,961
graphql-python/graphql-core
scripts/casing.py
snake
def snake(s): """Convert from title or camelCase to snake_case.""" if len(s) < 2: return s.lower() out = s[0].lower() for c in s[1:]: if c.isupper(): out += "_" c = c.lower() out += c return out
python
def snake(s): """Convert from title or camelCase to snake_case.""" if len(s) < 2: return s.lower() out = s[0].lower() for c in s[1:]: if c.isupper(): out += "_" c = c.lower() out += c return out
[ "def", "snake", "(", "s", ")", ":", "if", "len", "(", "s", ")", "<", "2", ":", "return", "s", ".", "lower", "(", ")", "out", "=", "s", "[", "0", "]", ".", "lower", "(", ")", "for", "c", "in", "s", "[", "1", ":", "]", ":", "if", "c", "...
Convert from title or camelCase to snake_case.
[ "Convert", "from", "title", "or", "camelCase", "to", "snake_case", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/scripts/casing.py#L19-L29
222,962
graphql-python/graphql-core
graphql/backend/quiver_cloud.py
GraphQLQuiverCloudBackend.make_post_request
def make_post_request(self, url, auth, json_payload): """This function executes the request with the provided json payload and return the json response""" response = requests.post(url, auth=auth, json=json_payload) return response.json()
python
def make_post_request(self, url, auth, json_payload): """This function executes the request with the provided json payload and return the json response""" response = requests.post(url, auth=auth, json=json_payload) return response.json()
[ "def", "make_post_request", "(", "self", ",", "url", ",", "auth", ",", "json_payload", ")", ":", "response", "=", "requests", ".", "post", "(", "url", ",", "auth", "=", "auth", ",", "json", "=", "json_payload", ")", "return", "response", ".", "json", "...
This function executes the request with the provided json payload and return the json response
[ "This", "function", "executes", "the", "request", "with", "the", "provided", "json", "payload", "and", "return", "the", "json", "response" ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/backend/quiver_cloud.py#L64-L68
222,963
graphql-python/graphql-core
graphql/utils/get_field_def.py
get_field_def
def get_field_def( schema, # type: GraphQLSchema parent_type, # type: Union[GraphQLInterfaceType, GraphQLObjectType] field_ast, # type: Field ): # type: (...) -> Optional[GraphQLField] """Not exactly the same as the executor's definition of get_field_def, in this statically evaluated environm...
python
def get_field_def( schema, # type: GraphQLSchema parent_type, # type: Union[GraphQLInterfaceType, GraphQLObjectType] field_ast, # type: Field ): # type: (...) -> Optional[GraphQLField] """Not exactly the same as the executor's definition of get_field_def, in this statically evaluated environm...
[ "def", "get_field_def", "(", "schema", ",", "# type: GraphQLSchema", "parent_type", ",", "# type: Union[GraphQLInterfaceType, GraphQLObjectType]", "field_ast", ",", "# type: Field", ")", ":", "# type: (...) -> Optional[GraphQLField]", "name", "=", "field_ast", ".", "name", "....
Not exactly the same as the executor's definition of get_field_def, in this statically evaluated environment we do not always have an Object type, and need to handle Interface and Union types.
[ "Not", "exactly", "the", "same", "as", "the", "executor", "s", "definition", "of", "get_field_def", "in", "this", "statically", "evaluated", "environment", "we", "do", "not", "always", "have", "an", "Object", "type", "and", "need", "to", "handle", "Interface",...
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/utils/get_field_def.py#L16-L38
222,964
graphql-python/graphql-core
graphql/validation/rules/overlapping_fields_can_be_merged.py
_find_conflicts_within_selection_set
def _find_conflicts_within_selection_set( context, # type: ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] compared_fragments, # type: PairSet parent_typ...
python
def _find_conflicts_within_selection_set( context, # type: ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] compared_fragments, # type: PairSet parent_typ...
[ "def", "_find_conflicts_within_selection_set", "(", "context", ",", "# type: ValidationContext", "cached_fields_and_fragment_names", ",", "# type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]]", "compared_fra...
Find all conflicts found "within" a selection set, including those found via spreading in fragments. Called when visiting each SelectionSet in the GraphQL Document.
[ "Find", "all", "conflicts", "found", "within", "a", "selection", "set", "including", "those", "found", "via", "spreading", "in", "fragments", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/validation/rules/overlapping_fields_can_be_merged.py#L167-L222
222,965
graphql-python/graphql-core
graphql/validation/rules/overlapping_fields_can_be_merged.py
_find_conflicts_between_sub_selection_sets
def _find_conflicts_between_sub_selection_sets( context, # type: ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] compared_fragments, # type: PairSet are_...
python
def _find_conflicts_between_sub_selection_sets( context, # type: ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] compared_fragments, # type: PairSet are_...
[ "def", "_find_conflicts_between_sub_selection_sets", "(", "context", ",", "# type: ValidationContext", "cached_fields_and_fragment_names", ",", "# type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]]", "compar...
Find all conflicts found between two selection sets. Includes those found via spreading in fragments. Called when determining if conflicts exist between the sub-fields of two overlapping fields.
[ "Find", "all", "conflicts", "found", "between", "two", "selection", "sets", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/validation/rules/overlapping_fields_can_be_merged.py#L348-L426
222,966
graphql-python/graphql-core
graphql/validation/rules/overlapping_fields_can_be_merged.py
_find_conflict
def _find_conflict( context, # type: ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] compared_fragments, # type: PairSet parent_fields_are_mutually_exclu...
python
def _find_conflict( context, # type: ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] compared_fragments, # type: PairSet parent_fields_are_mutually_exclu...
[ "def", "_find_conflict", "(", "context", ",", "# type: ValidationContext", "cached_fields_and_fragment_names", ",", "# type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]]", "compared_fragments", ",", "# t...
Determines if there is a conflict between two particular fields.
[ "Determines", "if", "there", "is", "a", "conflict", "between", "two", "particular", "fields", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/validation/rules/overlapping_fields_can_be_merged.py#L504-L583
222,967
graphql-python/graphql-core
graphql/validation/rules/overlapping_fields_can_be_merged.py
_get_referenced_fields_and_fragment_names
def _get_referenced_fields_and_fragment_names( context, # ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] fragment, # type: InlineFragment ): # type: (.....
python
def _get_referenced_fields_and_fragment_names( context, # ValidationContext cached_fields_and_fragment_names, # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]] fragment, # type: InlineFragment ): # type: (.....
[ "def", "_get_referenced_fields_and_fragment_names", "(", "context", ",", "# ValidationContext", "cached_fields_and_fragment_names", ",", "# type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]]", "fragment", ...
Given a reference to a fragment, return the represented collection of fields as well as a list of nested fragment names referenced via fragment spreads.
[ "Given", "a", "reference", "to", "a", "fragment", "return", "the", "represented", "collection", "of", "fields", "as", "well", "as", "a", "list", "of", "nested", "fragment", "names", "referenced", "via", "fragment", "spreads", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/validation/rules/overlapping_fields_can_be_merged.py#L609-L630
222,968
graphql-python/graphql-core
graphql/validation/rules/overlapping_fields_can_be_merged.py
_subfield_conflicts
def _subfield_conflicts( conflicts, # type: List[Tuple[Tuple[str, str], List[Node], List[Node]]] response_name, # type: str ast1, # type: Node ast2, # type: Node ): # type: (...) -> Optional[Tuple[Tuple[str, str], List[Node], List[Node]]] """Given a series of Conflicts which occurred between...
python
def _subfield_conflicts( conflicts, # type: List[Tuple[Tuple[str, str], List[Node], List[Node]]] response_name, # type: str ast1, # type: Node ast2, # type: Node ): # type: (...) -> Optional[Tuple[Tuple[str, str], List[Node], List[Node]]] """Given a series of Conflicts which occurred between...
[ "def", "_subfield_conflicts", "(", "conflicts", ",", "# type: List[Tuple[Tuple[str, str], List[Node], List[Node]]]", "response_name", ",", "# type: str", "ast1", ",", "# type: Node", "ast2", ",", "# type: Node", ")", ":", "# type: (...) -> Optional[Tuple[Tuple[str, str], List[Node]...
Given a series of Conflicts which occurred between two sub-fields, generate a single Conflict.
[ "Given", "a", "series", "of", "Conflicts", "which", "occurred", "between", "two", "sub", "-", "fields", "generate", "a", "single", "Conflict", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/validation/rules/overlapping_fields_can_be_merged.py#L677-L691
222,969
graphql-python/graphql-core
graphql/execution/utils.py
collect_fields
def collect_fields( ctx, # type: ExecutionContext runtime_type, # type: GraphQLObjectType selection_set, # type: SelectionSet fields, # type: DefaultOrderedDict prev_fragment_names, # type: Set[str] ): # type: (...) -> DefaultOrderedDict """ Given a selectionSet, adds all of the fie...
python
def collect_fields( ctx, # type: ExecutionContext runtime_type, # type: GraphQLObjectType selection_set, # type: SelectionSet fields, # type: DefaultOrderedDict prev_fragment_names, # type: Set[str] ): # type: (...) -> DefaultOrderedDict """ Given a selectionSet, adds all of the fie...
[ "def", "collect_fields", "(", "ctx", ",", "# type: ExecutionContext", "runtime_type", ",", "# type: GraphQLObjectType", "selection_set", ",", "# type: SelectionSet", "fields", ",", "# type: DefaultOrderedDict", "prev_fragment_names", ",", "# type: Set[str]", ")", ":", "# type...
Given a selectionSet, adds all of the fields in that selection to the passed in map of fields, and returns it at the end. collect_fields requires the "runtime type" of an object. For a field which returns and Interface or Union type, the "runtime type" will be the actual Object type returned by that fi...
[ "Given", "a", "selectionSet", "adds", "all", "of", "the", "fields", "in", "that", "selection", "to", "the", "passed", "in", "map", "of", "fields", "and", "returns", "it", "at", "the", "end", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/utils.py#L224-L282
222,970
graphql-python/graphql-core
graphql/execution/utils.py
should_include_node
def should_include_node(ctx, directives): # type: (ExecutionContext, Optional[List[Directive]]) -> bool """Determines if a field should be included based on the @include and @skip directives, where @skip has higher precidence than @include.""" # TODO: Refactor based on latest code if directives: ...
python
def should_include_node(ctx, directives): # type: (ExecutionContext, Optional[List[Directive]]) -> bool """Determines if a field should be included based on the @include and @skip directives, where @skip has higher precidence than @include.""" # TODO: Refactor based on latest code if directives: ...
[ "def", "should_include_node", "(", "ctx", ",", "directives", ")", ":", "# type: (ExecutionContext, Optional[List[Directive]]) -> bool", "# TODO: Refactor based on latest code", "if", "directives", ":", "skip_ast", "=", "None", "for", "directive", "in", "directives", ":", "i...
Determines if a field should be included based on the @include and @skip directives, where @skip has higher precidence than @include.
[ "Determines", "if", "a", "field", "should", "be", "included", "based", "on", "the" ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/utils.py#L285-L320
222,971
graphql-python/graphql-core
graphql/execution/utils.py
default_resolve_fn
def default_resolve_fn(source, info, **args): # type: (Any, ResolveInfo, **Any) -> Optional[Any] """If a resolve function is not given, then a default resolve behavior is used which takes the property of the source object of the same name as the field and returns it as the result, or if it's a function, ret...
python
def default_resolve_fn(source, info, **args): # type: (Any, ResolveInfo, **Any) -> Optional[Any] """If a resolve function is not given, then a default resolve behavior is used which takes the property of the source object of the same name as the field and returns it as the result, or if it's a function, ret...
[ "def", "default_resolve_fn", "(", "source", ",", "info", ",", "*", "*", "args", ")", ":", "# type: (Any, ResolveInfo, **Any) -> Optional[Any]", "name", "=", "info", ".", "field_name", "if", "isinstance", "(", "source", ",", "dict", ")", ":", "property", "=", "...
If a resolve function is not given, then a default resolve behavior is used which takes the property of the source object of the same name as the field and returns it as the result, or if it's a function, returns the result of calling that function.
[ "If", "a", "resolve", "function", "is", "not", "given", "then", "a", "default", "resolve", "behavior", "is", "used", "which", "takes", "the", "property", "of", "the", "source", "object", "of", "the", "same", "name", "as", "the", "field", "and", "returns", ...
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/utils.py#L351-L362
222,972
graphql-python/graphql-core
graphql/execution/values.py
get_variable_values
def get_variable_values( schema, # type: GraphQLSchema definition_asts, # type: List[VariableDefinition] inputs, # type: Any ): # type: (...) -> Dict[str, Any] """Prepares an object map of variables of the correct type based on the provided variable definitions and arbitrary input. If the inp...
python
def get_variable_values( schema, # type: GraphQLSchema definition_asts, # type: List[VariableDefinition] inputs, # type: Any ): # type: (...) -> Dict[str, Any] """Prepares an object map of variables of the correct type based on the provided variable definitions and arbitrary input. If the inp...
[ "def", "get_variable_values", "(", "schema", ",", "# type: GraphQLSchema", "definition_asts", ",", "# type: List[VariableDefinition]", "inputs", ",", "# type: Any", ")", ":", "# type: (...) -> Dict[str, Any]", "if", "inputs", "is", "None", ":", "inputs", "=", "{", "}", ...
Prepares an object map of variables of the correct type based on the provided variable definitions and arbitrary input. If the input cannot be parsed to match the variable definitions, a GraphQLError will be thrown.
[ "Prepares", "an", "object", "map", "of", "variables", "of", "the", "correct", "type", "based", "on", "the", "provided", "variable", "definitions", "and", "arbitrary", "input", ".", "If", "the", "input", "cannot", "be", "parsed", "to", "match", "the", "variab...
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/values.py#L34-L86
222,973
graphql-python/graphql-core
graphql/execution/values.py
get_argument_values
def get_argument_values( arg_defs, # type: Union[Dict[str, GraphQLArgument], Dict] arg_asts, # type: Optional[List[Argument]] variables=None, # type: Optional[Dict[str, Union[List, Dict, int, float, bool, str, None]]] ): # type: (...) -> Dict[str, Any] """Prepares an object map of argument values...
python
def get_argument_values( arg_defs, # type: Union[Dict[str, GraphQLArgument], Dict] arg_asts, # type: Optional[List[Argument]] variables=None, # type: Optional[Dict[str, Union[List, Dict, int, float, bool, str, None]]] ): # type: (...) -> Dict[str, Any] """Prepares an object map of argument values...
[ "def", "get_argument_values", "(", "arg_defs", ",", "# type: Union[Dict[str, GraphQLArgument], Dict]", "arg_asts", ",", "# type: Optional[List[Argument]]", "variables", "=", "None", ",", "# type: Optional[Dict[str, Union[List, Dict, int, float, bool, str, None]]]", ")", ":", "# type:...
Prepares an object map of argument values given a list of argument definitions and list of argument AST nodes.
[ "Prepares", "an", "object", "map", "of", "argument", "values", "given", "a", "list", "of", "argument", "definitions", "and", "list", "of", "argument", "AST", "nodes", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/values.py#L89-L148
222,974
graphql-python/graphql-core
graphql/execution/values.py
coerce_value
def coerce_value(type, value): # type: (Any, Any) -> Union[List, Dict, int, float, bool, str, None] """Given a type and any value, return a runtime value coerced to match the type.""" if isinstance(type, GraphQLNonNull): # Note: we're not checking that the result of coerceValue is # non-null...
python
def coerce_value(type, value): # type: (Any, Any) -> Union[List, Dict, int, float, bool, str, None] """Given a type and any value, return a runtime value coerced to match the type.""" if isinstance(type, GraphQLNonNull): # Note: we're not checking that the result of coerceValue is # non-null...
[ "def", "coerce_value", "(", "type", ",", "value", ")", ":", "# type: (Any, Any) -> Union[List, Dict, int, float, bool, str, None]", "if", "isinstance", "(", "type", ",", "GraphQLNonNull", ")", ":", "# Note: we're not checking that the result of coerceValue is", "# non-null.", "...
Given a type and any value, return a runtime value coerced to match the type.
[ "Given", "a", "type", "and", "any", "value", "return", "a", "runtime", "value", "coerced", "to", "match", "the", "type", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/execution/values.py#L151-L186
222,975
graphql-python/graphql-core
graphql/language/parser.py
parse
def parse(source, **kwargs): # type: (Union[Source, str], **Any) -> Document """Given a GraphQL source, parses it into a Document.""" options = {"no_location": False, "no_source": False} options.update(kwargs) if isinstance(source, string_types): source_obj = Source(source) # type: Source ...
python
def parse(source, **kwargs): # type: (Union[Source, str], **Any) -> Document """Given a GraphQL source, parses it into a Document.""" options = {"no_location": False, "no_source": False} options.update(kwargs) if isinstance(source, string_types): source_obj = Source(source) # type: Source ...
[ "def", "parse", "(", "source", ",", "*", "*", "kwargs", ")", ":", "# type: (Union[Source, str], **Any) -> Document", "options", "=", "{", "\"no_location\"", ":", "False", ",", "\"no_source\"", ":", "False", "}", "options", ".", "update", "(", "kwargs", ")", "i...
Given a GraphQL source, parses it into a Document.
[ "Given", "a", "GraphQL", "source", "parses", "it", "into", "a", "Document", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L52-L64
222,976
graphql-python/graphql-core
graphql/language/parser.py
loc
def loc(parser, start): # type: (Parser, int) -> Optional[Loc] """Returns a location object, used to identify the place in the source that created a given parsed object.""" if parser.options["no_location"]: return None if parser.options["no_source"]: return Loc(start, parser.prev_en...
python
def loc(parser, start): # type: (Parser, int) -> Optional[Loc] """Returns a location object, used to identify the place in the source that created a given parsed object.""" if parser.options["no_location"]: return None if parser.options["no_source"]: return Loc(start, parser.prev_en...
[ "def", "loc", "(", "parser", ",", "start", ")", ":", "# type: (Parser, int) -> Optional[Loc]", "if", "parser", ".", "options", "[", "\"no_location\"", "]", ":", "return", "None", "if", "parser", ".", "options", "[", "\"no_source\"", "]", ":", "return", "Loc", ...
Returns a location object, used to identify the place in the source that created a given parsed object.
[ "Returns", "a", "location", "object", "used", "to", "identify", "the", "place", "in", "the", "source", "that", "created", "a", "given", "parsed", "object", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L114-L124
222,977
graphql-python/graphql-core
graphql/language/parser.py
advance
def advance(parser): # type: (Parser) -> None """Moves the internal parser object to the next lexed token.""" prev_end = parser.token.end parser.prev_end = prev_end parser.token = parser.lexer.next_token(prev_end)
python
def advance(parser): # type: (Parser) -> None """Moves the internal parser object to the next lexed token.""" prev_end = parser.token.end parser.prev_end = prev_end parser.token = parser.lexer.next_token(prev_end)
[ "def", "advance", "(", "parser", ")", ":", "# type: (Parser) -> None", "prev_end", "=", "parser", ".", "token", ".", "end", "parser", ".", "prev_end", "=", "prev_end", "parser", ".", "token", "=", "parser", ".", "lexer", ".", "next_token", "(", "prev_end", ...
Moves the internal parser object to the next lexed token.
[ "Moves", "the", "internal", "parser", "object", "to", "the", "next", "lexed", "token", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L127-L132
222,978
graphql-python/graphql-core
graphql/language/parser.py
skip
def skip(parser, kind): # type: (Parser, int) -> bool """If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and throw an error.""" match = parser.token.kind == kind if match: advance(parser) return match
python
def skip(parser, kind): # type: (Parser, int) -> bool """If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and throw an error.""" match = parser.token.kind == kind if match: advance(parser) return match
[ "def", "skip", "(", "parser", ",", "kind", ")", ":", "# type: (Parser, int) -> bool", "match", "=", "parser", ".", "token", ".", "kind", "==", "kind", "if", "match", ":", "advance", "(", "parser", ")", "return", "match" ]
If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and throw an error.
[ "If", "the", "next", "token", "is", "of", "the", "given", "kind", "return", "true", "after", "advancing", "the", "parser", ".", "Otherwise", "do", "not", "change", "the", "parser", "state", "and", "throw", "an", "error", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L141-L150
222,979
graphql-python/graphql-core
graphql/language/parser.py
expect
def expect(parser, kind): # type: (Parser, int) -> Token """If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return False.""" token = parser.token if token.kind == kind: advance(parser) return toke...
python
def expect(parser, kind): # type: (Parser, int) -> Token """If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return False.""" token = parser.token if token.kind == kind: advance(parser) return toke...
[ "def", "expect", "(", "parser", ",", "kind", ")", ":", "# type: (Parser, int) -> Token", "token", "=", "parser", ".", "token", "if", "token", ".", "kind", "==", "kind", ":", "advance", "(", "parser", ")", "return", "token", "raise", "GraphQLSyntaxError", "("...
If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return False.
[ "If", "the", "next", "token", "is", "of", "the", "given", "kind", "return", "that", "token", "after", "advancing", "the", "parser", ".", "Otherwise", "do", "not", "change", "the", "parser", "state", "and", "return", "False", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L153-L169
222,980
graphql-python/graphql-core
graphql/language/parser.py
expect_keyword
def expect_keyword(parser, value): # type: (Parser, str) -> Token """If the next token is a keyword with the given value, return that token after advancing the parser. Otherwise, do not change the parser state and return False.""" token = parser.token if token.kind == TokenKind.NAME and token.va...
python
def expect_keyword(parser, value): # type: (Parser, str) -> Token """If the next token is a keyword with the given value, return that token after advancing the parser. Otherwise, do not change the parser state and return False.""" token = parser.token if token.kind == TokenKind.NAME and token.va...
[ "def", "expect_keyword", "(", "parser", ",", "value", ")", ":", "# type: (Parser, str) -> Token", "token", "=", "parser", ".", "token", "if", "token", ".", "kind", "==", "TokenKind", ".", "NAME", "and", "token", ".", "value", "==", "value", ":", "advance", ...
If the next token is a keyword with the given value, return that token after advancing the parser. Otherwise, do not change the parser state and return False.
[ "If", "the", "next", "token", "is", "a", "keyword", "with", "the", "given", "value", "return", "that", "token", "after", "advancing", "the", "parser", ".", "Otherwise", "do", "not", "change", "the", "parser", "state", "and", "return", "False", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L172-L186
222,981
graphql-python/graphql-core
graphql/language/parser.py
unexpected
def unexpected(parser, at_token=None): # type: (Parser, Optional[Any]) -> GraphQLSyntaxError """Helper function for creating an error when an unexpected lexed token is encountered.""" token = at_token or parser.token return GraphQLSyntaxError( parser.source, token.start, u"Unexpected {}".for...
python
def unexpected(parser, at_token=None): # type: (Parser, Optional[Any]) -> GraphQLSyntaxError """Helper function for creating an error when an unexpected lexed token is encountered.""" token = at_token or parser.token return GraphQLSyntaxError( parser.source, token.start, u"Unexpected {}".for...
[ "def", "unexpected", "(", "parser", ",", "at_token", "=", "None", ")", ":", "# type: (Parser, Optional[Any]) -> GraphQLSyntaxError", "token", "=", "at_token", "or", "parser", ".", "token", "return", "GraphQLSyntaxError", "(", "parser", ".", "source", ",", "token", ...
Helper function for creating an error when an unexpected lexed token is encountered.
[ "Helper", "function", "for", "creating", "an", "error", "when", "an", "unexpected", "lexed", "token", "is", "encountered", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L189-L196
222,982
graphql-python/graphql-core
graphql/language/parser.py
any
def any(parser, open_kind, parse_fn, close_kind): # type: (Parser, int, Callable, int) -> Any """Returns a possibly empty list of parse nodes, determined by the parse_fn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token a...
python
def any(parser, open_kind, parse_fn, close_kind): # type: (Parser, int, Callable, int) -> Any """Returns a possibly empty list of parse nodes, determined by the parse_fn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token a...
[ "def", "any", "(", "parser", ",", "open_kind", ",", "parse_fn", ",", "close_kind", ")", ":", "# type: (Parser, int, Callable, int) -> Any", "expect", "(", "parser", ",", "open_kind", ")", "nodes", "=", "[", "]", "while", "not", "skip", "(", "parser", ",", "c...
Returns a possibly empty list of parse nodes, determined by the parse_fn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
[ "Returns", "a", "possibly", "empty", "list", "of", "parse", "nodes", "determined", "by", "the", "parse_fn", ".", "This", "list", "begins", "with", "a", "lex", "token", "of", "openKind", "and", "ends", "with", "a", "lex", "token", "of", "closeKind", ".", ...
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L199-L210
222,983
graphql-python/graphql-core
graphql/language/parser.py
parse_name
def parse_name(parser): # type: (Parser) -> Name """Converts a name lex token into a name parse node.""" token = expect(parser, TokenKind.NAME) return ast.Name(value=token.value, loc=loc(parser, token.start))
python
def parse_name(parser): # type: (Parser) -> Name """Converts a name lex token into a name parse node.""" token = expect(parser, TokenKind.NAME) return ast.Name(value=token.value, loc=loc(parser, token.start))
[ "def", "parse_name", "(", "parser", ")", ":", "# type: (Parser) -> Name", "token", "=", "expect", "(", "parser", ",", "TokenKind", ".", "NAME", ")", "return", "ast", ".", "Name", "(", "value", "=", "token", ".", "value", ",", "loc", "=", "loc", "(", "p...
Converts a name lex token into a name parse node.
[ "Converts", "a", "name", "lex", "token", "into", "a", "name", "parse", "node", "." ]
d8e9d3abe7c209eb2f51cf001402783bfd480596
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L227-L231
222,984
kieferk/dfply
dfply/summary_functions.py
mean
def mean(series): """ Returns the mean of a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.mean() else: return np.nan
python
def mean(series): """ Returns the mean of a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.mean() else: return np.nan
[ "def", "mean", "(", "series", ")", ":", "if", "np", ".", "issubdtype", "(", "series", ".", "dtype", ",", "np", ".", "number", ")", ":", "return", "series", ".", "mean", "(", ")", "else", ":", "return", "np", ".", "nan" ]
Returns the mean of a series. Args: series (pandas.Series): column to summarize.
[ "Returns", "the", "mean", "of", "a", "series", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/summary_functions.py#L11-L22
222,985
kieferk/dfply
dfply/summary_functions.py
first
def first(series, order_by=None): """ Returns the first value of a series. Args: series (pandas.Series): column to summarize. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order the input series by before summarization. """ if order_by is...
python
def first(series, order_by=None): """ Returns the first value of a series. Args: series (pandas.Series): column to summarize. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order the input series by before summarization. """ if order_by is...
[ "def", "first", "(", "series", ",", "order_by", "=", "None", ")", ":", "if", "order_by", "is", "not", "None", ":", "series", "=", "order_series_by", "(", "series", ",", "order_by", ")", "first_s", "=", "series", ".", "iloc", "[", "0", "]", "return", ...
Returns the first value of a series. Args: series (pandas.Series): column to summarize. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order the input series by before summarization.
[ "Returns", "the", "first", "value", "of", "a", "series", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/summary_functions.py#L26-L41
222,986
kieferk/dfply
dfply/summary_functions.py
last
def last(series, order_by=None): """ Returns the last value of a series. Args: series (pandas.Series): column to summarize. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order the input series by before summarization. """ if order_by is n...
python
def last(series, order_by=None): """ Returns the last value of a series. Args: series (pandas.Series): column to summarize. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order the input series by before summarization. """ if order_by is n...
[ "def", "last", "(", "series", ",", "order_by", "=", "None", ")", ":", "if", "order_by", "is", "not", "None", ":", "series", "=", "order_series_by", "(", "series", ",", "order_by", ")", "last_s", "=", "series", ".", "iloc", "[", "series", ".", "size", ...
Returns the last value of a series. Args: series (pandas.Series): column to summarize. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order the input series by before summarization.
[ "Returns", "the", "last", "value", "of", "a", "series", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/summary_functions.py#L45-L60
222,987
kieferk/dfply
dfply/summary_functions.py
nth
def nth(series, n, order_by=None): """ Returns the nth value of a series. Args: series (pandas.Series): column to summarize. n (integer): position of desired value. Returns `NaN` if out of range. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order ...
python
def nth(series, n, order_by=None): """ Returns the nth value of a series. Args: series (pandas.Series): column to summarize. n (integer): position of desired value. Returns `NaN` if out of range. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order ...
[ "def", "nth", "(", "series", ",", "n", ",", "order_by", "=", "None", ")", ":", "if", "order_by", "is", "not", "None", ":", "series", "=", "order_series_by", "(", "series", ",", "order_by", ")", "try", ":", "return", "series", ".", "iloc", "[", "n", ...
Returns the nth value of a series. Args: series (pandas.Series): column to summarize. n (integer): position of desired value. Returns `NaN` if out of range. Kwargs: order_by: a pandas.Series or list of series (can be symbolic) to order the input series by before summarizati...
[ "Returns", "the", "nth", "value", "of", "a", "series", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/summary_functions.py#L64-L82
222,988
kieferk/dfply
dfply/summary_functions.py
median
def median(series): """ Returns the median value of a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.median() else: return np.nan
python
def median(series): """ Returns the median value of a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.median() else: return np.nan
[ "def", "median", "(", "series", ")", ":", "if", "np", ".", "issubdtype", "(", "series", ".", "dtype", ",", "np", ".", "number", ")", ":", "return", "series", ".", "median", "(", ")", "else", ":", "return", "np", ".", "nan" ]
Returns the median value of a series. Args: series (pandas.Series): column to summarize.
[ "Returns", "the", "median", "value", "of", "a", "series", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/summary_functions.py#L153-L164
222,989
kieferk/dfply
dfply/summary_functions.py
var
def var(series): """ Returns the variance of values in a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.var() else: return np.nan
python
def var(series): """ Returns the variance of values in a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.var() else: return np.nan
[ "def", "var", "(", "series", ")", ":", "if", "np", ".", "issubdtype", "(", "series", ".", "dtype", ",", "np", ".", "number", ")", ":", "return", "series", ".", "var", "(", ")", "else", ":", "return", "np", ".", "nan" ]
Returns the variance of values in a series. Args: series (pandas.Series): column to summarize.
[ "Returns", "the", "variance", "of", "values", "in", "a", "series", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/summary_functions.py#L168-L178
222,990
kieferk/dfply
dfply/summary_functions.py
sd
def sd(series): """ Returns the standard deviation of values in a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.std() else: return np.nan
python
def sd(series): """ Returns the standard deviation of values in a series. Args: series (pandas.Series): column to summarize. """ if np.issubdtype(series.dtype, np.number): return series.std() else: return np.nan
[ "def", "sd", "(", "series", ")", ":", "if", "np", ".", "issubdtype", "(", "series", ".", "dtype", ",", "np", ".", "number", ")", ":", "return", "series", ".", "std", "(", ")", "else", ":", "return", "np", ".", "nan" ]
Returns the standard deviation of values in a series. Args: series (pandas.Series): column to summarize.
[ "Returns", "the", "standard", "deviation", "of", "values", "in", "a", "series", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/summary_functions.py#L182-L193
222,991
kieferk/dfply
dfply/join.py
get_join_parameters
def get_join_parameters(join_kwargs): """ Convenience function to determine the columns to join the right and left DataFrames on, as well as any suffixes for the columns. """ by = join_kwargs.get('by', None) suffixes = join_kwargs.get('suffixes', ('_x', '_y')) if isinstance(by, tuple): ...
python
def get_join_parameters(join_kwargs): """ Convenience function to determine the columns to join the right and left DataFrames on, as well as any suffixes for the columns. """ by = join_kwargs.get('by', None) suffixes = join_kwargs.get('suffixes', ('_x', '_y')) if isinstance(by, tuple): ...
[ "def", "get_join_parameters", "(", "join_kwargs", ")", ":", "by", "=", "join_kwargs", ".", "get", "(", "'by'", ",", "None", ")", "suffixes", "=", "join_kwargs", ".", "get", "(", "'suffixes'", ",", "(", "'_x'", ",", "'_y'", ")", ")", "if", "isinstance", ...
Convenience function to determine the columns to join the right and left DataFrames on, as well as any suffixes for the columns.
[ "Convenience", "function", "to", "determine", "the", "columns", "to", "join", "the", "right", "and", "left", "DataFrames", "on", "as", "well", "as", "any", "suffixes", "for", "the", "columns", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/join.py#L8-L23
222,992
kieferk/dfply
dfply/join.py
inner_join
def inner_join(df, other, **kwargs): """ Joins on values present in both DataFrames. Args: df (pandas.DataFrame): Left DataFrame (passed in via pipe) other (pandas.DataFrame): Right DataFrame Kwargs: by (str or list): Columns to join on. If a single string, will join ...
python
def inner_join(df, other, **kwargs): """ Joins on values present in both DataFrames. Args: df (pandas.DataFrame): Left DataFrame (passed in via pipe) other (pandas.DataFrame): Right DataFrame Kwargs: by (str or list): Columns to join on. If a single string, will join ...
[ "def", "inner_join", "(", "df", ",", "other", ",", "*", "*", "kwargs", ")", ":", "left_on", ",", "right_on", ",", "suffixes", "=", "get_join_parameters", "(", "kwargs", ")", "joined", "=", "df", ".", "merge", "(", "other", ",", "how", "=", "'inner'", ...
Joins on values present in both DataFrames. Args: df (pandas.DataFrame): Left DataFrame (passed in via pipe) other (pandas.DataFrame): Right DataFrame Kwargs: by (str or list): Columns to join on. If a single string, will join on that column. If a list of lists which contai...
[ "Joins", "on", "values", "present", "in", "both", "DataFrames", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/join.py#L27-L53
222,993
kieferk/dfply
dfply/join.py
anti_join
def anti_join(df, other, **kwargs): """ Returns all of the rows in the left DataFrame that do not have a match in the right DataFrame. Args: df (pandas.DataFrame): Left DataFrame (passed in via pipe) other (pandas.DataFrame): Right DataFrame Kwargs: by (str or list): Column...
python
def anti_join(df, other, **kwargs): """ Returns all of the rows in the left DataFrame that do not have a match in the right DataFrame. Args: df (pandas.DataFrame): Left DataFrame (passed in via pipe) other (pandas.DataFrame): Right DataFrame Kwargs: by (str or list): Column...
[ "def", "anti_join", "(", "df", ",", "other", ",", "*", "*", "kwargs", ")", ":", "left_on", ",", "right_on", ",", "suffixes", "=", "get_join_parameters", "(", "kwargs", ")", "if", "not", "right_on", ":", "right_on", "=", "[", "col_name", "for", "col_name"...
Returns all of the rows in the left DataFrame that do not have a match in the right DataFrame. Args: df (pandas.DataFrame): Left DataFrame (passed in via pipe) other (pandas.DataFrame): Right DataFrame Kwargs: by (str or list): Columns to join on. If a single string, will join ...
[ "Returns", "all", "of", "the", "rows", "in", "the", "left", "DataFrame", "that", "do", "not", "have", "a", "match", "in", "the", "right", "DataFrame", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/join.py#L219-L250
222,994
kieferk/dfply
dfply/join.py
bind_rows
def bind_rows(df, other, join='outer', ignore_index=False): """ Binds DataFrames "vertically", stacking them together. This is equivalent to `pd.concat` with `axis=0`. Args: df (pandas.DataFrame): Top DataFrame (passed in via pipe). other (pandas.DataFrame): Bottom DataFrame. Kwarg...
python
def bind_rows(df, other, join='outer', ignore_index=False): """ Binds DataFrames "vertically", stacking them together. This is equivalent to `pd.concat` with `axis=0`. Args: df (pandas.DataFrame): Top DataFrame (passed in via pipe). other (pandas.DataFrame): Bottom DataFrame. Kwarg...
[ "def", "bind_rows", "(", "df", ",", "other", ",", "join", "=", "'outer'", ",", "ignore_index", "=", "False", ")", ":", "df", "=", "pd", ".", "concat", "(", "[", "df", ",", "other", "]", ",", "join", "=", "join", ",", "ignore_index", "=", "ignore_in...
Binds DataFrames "vertically", stacking them together. This is equivalent to `pd.concat` with `axis=0`. Args: df (pandas.DataFrame): Top DataFrame (passed in via pipe). other (pandas.DataFrame): Bottom DataFrame. Kwargs: join (str): One of `"outer"` or `"inner"`. Outer join will pr...
[ "Binds", "DataFrames", "vertically", "stacking", "them", "together", ".", "This", "is", "equivalent", "to", "pd", ".", "concat", "with", "axis", "=", "0", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/join.py#L258-L276
222,995
kieferk/dfply
dfply/reshape.py
arrange
def arrange(df, *args, **kwargs): """Calls `pandas.DataFrame.sort_values` to sort a DataFrame according to criteria. See: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sort_values.html For a list of specific keyword arguments for sort_values (which will be the same in ...
python
def arrange(df, *args, **kwargs): """Calls `pandas.DataFrame.sort_values` to sort a DataFrame according to criteria. See: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sort_values.html For a list of specific keyword arguments for sort_values (which will be the same in ...
[ "def", "arrange", "(", "df", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "flat_args", "=", "[", "a", "for", "a", "in", "flatten", "(", "args", ")", "]", "series", "=", "[", "df", "[", "arg", "]", "if", "isinstance", "(", "arg", ",", ...
Calls `pandas.DataFrame.sort_values` to sort a DataFrame according to criteria. See: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sort_values.html For a list of specific keyword arguments for sort_values (which will be the same in arrange). Args: *args: Symbo...
[ "Calls", "pandas", ".", "DataFrame", ".", "sort_values", "to", "sort", "a", "DataFrame", "according", "to", "criteria", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/reshape.py#L10-L37
222,996
kieferk/dfply
dfply/reshape.py
rename
def rename(df, **kwargs): """Renames columns, where keyword argument values are the current names of columns and keys are the new names. Args: df (:obj:`pandas.DataFrame`): DataFrame passed in via `>>` pipe. Kwargs: **kwargs: key:value pairs where keys are new names for columns and ...
python
def rename(df, **kwargs): """Renames columns, where keyword argument values are the current names of columns and keys are the new names. Args: df (:obj:`pandas.DataFrame`): DataFrame passed in via `>>` pipe. Kwargs: **kwargs: key:value pairs where keys are new names for columns and ...
[ "def", "rename", "(", "df", ",", "*", "*", "kwargs", ")", ":", "return", "df", ".", "rename", "(", "columns", "=", "{", "v", ":", "k", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", "}", ")" ]
Renames columns, where keyword argument values are the current names of columns and keys are the new names. Args: df (:obj:`pandas.DataFrame`): DataFrame passed in via `>>` pipe. Kwargs: **kwargs: key:value pairs where keys are new names for columns and values are current names...
[ "Renames", "columns", "where", "keyword", "argument", "values", "are", "the", "current", "names", "of", "columns", "and", "keys", "are", "the", "new", "names", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/reshape.py#L46-L58
222,997
kieferk/dfply
dfply/reshape.py
convert_type
def convert_type(df, columns): """ Helper function that attempts to convert columns into their appropriate data type. """ # taken in part from the dplython package out_df = df.copy() for col in columns: column_values = pd.Series(out_df[col].unique()) column_values = column_va...
python
def convert_type(df, columns): """ Helper function that attempts to convert columns into their appropriate data type. """ # taken in part from the dplython package out_df = df.copy() for col in columns: column_values = pd.Series(out_df[col].unique()) column_values = column_va...
[ "def", "convert_type", "(", "df", ",", "columns", ")", ":", "# taken in part from the dplython package", "out_df", "=", "df", ".", "copy", "(", ")", "for", "col", "in", "columns", ":", "column_values", "=", "pd", ".", "Series", "(", "out_df", "[", "col", "...
Helper function that attempts to convert columns into their appropriate data type.
[ "Helper", "function", "that", "attempts", "to", "convert", "columns", "into", "their", "appropriate", "data", "type", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/reshape.py#L111-L138
222,998
kieferk/dfply
dfply/reshape.py
spread
def spread(df, key, values, convert=False): """ Transforms a "long" DataFrame into a "wide" format using a key and value column. If you have a mixed datatype column in your long-format DataFrame then the default behavior is for the spread columns to be of type `object`, or string. If you want t...
python
def spread(df, key, values, convert=False): """ Transforms a "long" DataFrame into a "wide" format using a key and value column. If you have a mixed datatype column in your long-format DataFrame then the default behavior is for the spread columns to be of type `object`, or string. If you want t...
[ "def", "spread", "(", "df", ",", "key", ",", "values", ",", "convert", "=", "False", ")", ":", "# Taken mostly from dplython package", "columns", "=", "df", ".", "columns", ".", "tolist", "(", ")", "id_cols", "=", "[", "col", "for", "col", "in", "columns...
Transforms a "long" DataFrame into a "wide" format using a key and value column. If you have a mixed datatype column in your long-format DataFrame then the default behavior is for the spread columns to be of type `object`, or string. If you want to try to convert dtypes when spreading, you can set ...
[ "Transforms", "a", "long", "DataFrame", "into", "a", "wide", "format", "using", "a", "key", "and", "value", "column", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/reshape.py#L143-L201
222,999
kieferk/dfply
dfply/reshape.py
separate
def separate(df, column, into, sep="[\W_]+", remove=True, convert=False, extra='drop', fill='right'): """ Splits columns into multiple columns. Args: df (pandas.DataFrame): DataFrame passed in through the pipe. column (str, symbolic): Label of column to split. into (lis...
python
def separate(df, column, into, sep="[\W_]+", remove=True, convert=False, extra='drop', fill='right'): """ Splits columns into multiple columns. Args: df (pandas.DataFrame): DataFrame passed in through the pipe. column (str, symbolic): Label of column to split. into (lis...
[ "def", "separate", "(", "df", ",", "column", ",", "into", ",", "sep", "=", "\"[\\W_]+\"", ",", "remove", "=", "True", ",", "convert", "=", "False", ",", "extra", "=", "'drop'", ",", "fill", "=", "'right'", ")", ":", "assert", "isinstance", "(", "into...
Splits columns into multiple columns. Args: df (pandas.DataFrame): DataFrame passed in through the pipe. column (str, symbolic): Label of column to split. into (list): List of string names for new columns. Kwargs: sep (str or list): If a string, the regex string used to split t...
[ "Splits", "columns", "into", "multiple", "columns", "." ]
6a858f066602735a90f8b6b85106bc39ceadc282
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/reshape.py#L210-L272