partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | PyIndenterMode.indent | Performs an indentation | pyqode/python/modes/indenter.py | def indent(self):
"""
Performs an indentation
"""
if not self.tab_always_indent:
super(PyIndenterMode, self).indent()
else:
cursor = self.editor.textCursor()
assert isinstance(cursor, QtGui.QTextCursor)
if cursor.hasSelection():
... | def indent(self):
"""
Performs an indentation
"""
if not self.tab_always_indent:
super(PyIndenterMode, self).indent()
else:
cursor = self.editor.textCursor()
assert isinstance(cursor, QtGui.QTextCursor)
if cursor.hasSelection():
... | [
"Performs",
"an",
"indentation"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/indenter.py#L38-L58 | [
"def",
"indent",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"tab_always_indent",
":",
"super",
"(",
"PyIndenterMode",
",",
"self",
")",
".",
"indent",
"(",
")",
"else",
":",
"cursor",
"=",
"self",
".",
"editor",
".",
"textCursor",
"(",
")",
"as... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyIndenterMode.unindent | Performs an un-indentation | pyqode/python/modes/indenter.py | def unindent(self):
"""
Performs an un-indentation
"""
if self.tab_always_indent:
cursor = self.editor.textCursor()
if not cursor.hasSelection():
cursor.select(cursor.LineUnderCursor)
self.unindent_selection(cursor)
else:
... | def unindent(self):
"""
Performs an un-indentation
"""
if self.tab_always_indent:
cursor = self.editor.textCursor()
if not cursor.hasSelection():
cursor.select(cursor.LineUnderCursor)
self.unindent_selection(cursor)
else:
... | [
"Performs",
"an",
"un",
"-",
"indentation"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/indenter.py#L60-L70 | [
"def",
"unindent",
"(",
"self",
")",
":",
"if",
"self",
".",
"tab_always_indent",
":",
"cursor",
"=",
"self",
".",
"editor",
".",
"textCursor",
"(",
")",
"if",
"not",
"cursor",
".",
"hasSelection",
"(",
")",
":",
"cursor",
".",
"select",
"(",
"cursor",... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyAutoIndentMode._handle_indent_between_paren | Handle indent between symbols such as parenthesis, braces,... | pyqode/python/modes/autoindent.py | def _handle_indent_between_paren(self, column, line, parent_impl, tc):
"""
Handle indent between symbols such as parenthesis, braces,...
"""
pre, post = parent_impl
next_char = self._get_next_char(tc)
prev_char = self._get_prev_char(tc)
prev_open = prev_char in ['... | def _handle_indent_between_paren(self, column, line, parent_impl, tc):
"""
Handle indent between symbols such as parenthesis, braces,...
"""
pre, post = parent_impl
next_char = self._get_next_char(tc)
prev_char = self._get_prev_char(tc)
prev_open = prev_char in ['... | [
"Handle",
"indent",
"between",
"symbols",
"such",
"as",
"parenthesis",
"braces",
"..."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/autoindent.py#L249-L298 | [
"def",
"_handle_indent_between_paren",
"(",
"self",
",",
"column",
",",
"line",
",",
"parent_impl",
",",
"tc",
")",
":",
"pre",
",",
"post",
"=",
"parent_impl",
"next_char",
"=",
"self",
".",
"_get_next_char",
"(",
"tc",
")",
"prev_char",
"=",
"self",
".",... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyAutoIndentMode._at_block_start | Improve QTextCursor.atBlockStart to ignore spaces | pyqode/python/modes/autoindent.py | def _at_block_start(tc, line):
"""
Improve QTextCursor.atBlockStart to ignore spaces
"""
if tc.atBlockStart():
return True
column = tc.columnNumber()
indentation = len(line) - len(line.lstrip())
return column <= indentation | def _at_block_start(tc, line):
"""
Improve QTextCursor.atBlockStart to ignore spaces
"""
if tc.atBlockStart():
return True
column = tc.columnNumber()
indentation = len(line) - len(line.lstrip())
return column <= indentation | [
"Improve",
"QTextCursor",
".",
"atBlockStart",
"to",
"ignore",
"spaces"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/autoindent.py#L301-L309 | [
"def",
"_at_block_start",
"(",
"tc",
",",
"line",
")",
":",
"if",
"tc",
".",
"atBlockStart",
"(",
")",
":",
"return",
"True",
"column",
"=",
"tc",
".",
"columnNumber",
"(",
")",
"indentation",
"=",
"len",
"(",
"line",
")",
"-",
"len",
"(",
"line",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyFileManager.detect_encoding | For the implementation of encoding definitions in Python, look at:
- http://www.python.org/dev/peps/pep-0263/
.. note:: code taken and adapted from
```jedi.common.source_to_unicode.detect_encoding``` | pyqode/python/managers/file.py | def detect_encoding(self, path):
"""
For the implementation of encoding definitions in Python, look at:
- http://www.python.org/dev/peps/pep-0263/
.. note:: code taken and adapted from
```jedi.common.source_to_unicode.detect_encoding```
"""
with open(path, 'r... | def detect_encoding(self, path):
"""
For the implementation of encoding definitions in Python, look at:
- http://www.python.org/dev/peps/pep-0263/
.. note:: code taken and adapted from
```jedi.common.source_to_unicode.detect_encoding```
"""
with open(path, 'r... | [
"For",
"the",
"implementation",
"of",
"encoding",
"definitions",
"in",
"Python",
"look",
"at",
":",
"-",
"http",
":",
"//",
"www",
".",
"python",
".",
"org",
"/",
"dev",
"/",
"peps",
"/",
"pep",
"-",
"0263",
"/"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/managers/file.py#L23-L47 | [
"def",
"detect_encoding",
"(",
"self",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"file",
":",
"source",
"=",
"file",
".",
"read",
"(",
")",
"# take care of line encodings (not in jedi)",
"source",
"=",
"source",
".",
"repl... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | CommentsMode.on_state_changed | Called when the mode is activated/deactivated | pyqode/python/modes/comments.py | def on_state_changed(self, state):
"""
Called when the mode is activated/deactivated
"""
if state:
self.action.triggered.connect(self.comment)
self.editor.add_action(self.action, sub_menu='Python')
if 'pyqt5' in os.environ['QT_API'].lower():
... | def on_state_changed(self, state):
"""
Called when the mode is activated/deactivated
"""
if state:
self.action.triggered.connect(self.comment)
self.editor.add_action(self.action, sub_menu='Python')
if 'pyqt5' in os.environ['QT_API'].lower():
... | [
"Called",
"when",
"the",
"mode",
"is",
"activated",
"/",
"deactivated"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/comments.py#L19-L32 | [
"def",
"on_state_changed",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
":",
"self",
".",
"action",
".",
"triggered",
".",
"connect",
"(",
"self",
".",
"comment",
")",
"self",
".",
"editor",
".",
"add_action",
"(",
"self",
".",
"action",
",",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | CommentsMode.comment | Comments/Uncomments the selected lines or the current lines if there
is no selection. | pyqode/python/modes/comments.py | def comment(self):
"""
Comments/Uncomments the selected lines or the current lines if there
is no selection.
"""
cursor = self.editor.textCursor()
# get the indent at which comment should be inserted and whether to
# comment or uncomment the selected text
... | def comment(self):
"""
Comments/Uncomments the selected lines or the current lines if there
is no selection.
"""
cursor = self.editor.textCursor()
# get the indent at which comment should be inserted and whether to
# comment or uncomment the selected text
... | [
"Comments",
"/",
"Uncomments",
"the",
"selected",
"lines",
"or",
"the",
"current",
"lines",
"if",
"there",
"is",
"no",
"selection",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/comments.py#L78-L108 | [
"def",
"comment",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"editor",
".",
"textCursor",
"(",
")",
"# get the indent at which comment should be inserted and whether to",
"# comment or uncomment the selected text",
"indent",
",",
"comment",
",",
"nb_lines",
"=",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyCodeEditBase.setPlainText | Extends QCodeEdit.setPlainText to allow user to setPlainText without
mimetype (since the python syntax highlighter does not use it). | pyqode/python/widgets/code_edit.py | def setPlainText(self, txt, mimetype='text/x-python', encoding='utf-8'):
"""
Extends QCodeEdit.setPlainText to allow user to setPlainText without
mimetype (since the python syntax highlighter does not use it).
"""
try:
self.syntax_highlighter.docstrings[:] = []
... | def setPlainText(self, txt, mimetype='text/x-python', encoding='utf-8'):
"""
Extends QCodeEdit.setPlainText to allow user to setPlainText without
mimetype (since the python syntax highlighter does not use it).
"""
try:
self.syntax_highlighter.docstrings[:] = []
... | [
"Extends",
"QCodeEdit",
".",
"setPlainText",
"to",
"allow",
"user",
"to",
"setPlainText",
"without",
"mimetype",
"(",
"since",
"the",
"python",
"syntax",
"highlighter",
"does",
"not",
"use",
"it",
")",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/widgets/code_edit.py#L34-L44 | [
"def",
"setPlainText",
"(",
"self",
",",
"txt",
",",
"mimetype",
"=",
"'text/x-python'",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"try",
":",
"self",
".",
"syntax_highlighter",
".",
"docstrings",
"[",
":",
"]",
"=",
"[",
"]",
"self",
".",
"syntax_highl... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyConsole.update_terminal_colors | Update terminal color scheme based on the pygments color scheme colors | pyqode/python/widgets/console.py | def update_terminal_colors(self):
"""
Update terminal color scheme based on the pygments color scheme colors
"""
self.color_scheme = self.create_color_scheme(
background=self.syntax_highlighter.color_scheme.background,
foreground=self.syntax_highlighter.color_sche... | def update_terminal_colors(self):
"""
Update terminal color scheme based on the pygments color scheme colors
"""
self.color_scheme = self.create_color_scheme(
background=self.syntax_highlighter.color_scheme.background,
foreground=self.syntax_highlighter.color_sche... | [
"Update",
"terminal",
"color",
"scheme",
"based",
"on",
"the",
"pygments",
"color",
"scheme",
"colors"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/widgets/console.py#L71-L77 | [
"def",
"update_terminal_colors",
"(",
"self",
")",
":",
"self",
".",
"color_scheme",
"=",
"self",
".",
"create_color_scheme",
"(",
"background",
"=",
"self",
".",
"syntax_highlighter",
".",
"color_scheme",
".",
"background",
",",
"foreground",
"=",
"self",
".",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyInteractiveConsole.mouseMoveEvent | Extends mouseMoveEvent to display a pointing hand cursor when the
mouse cursor is over a file location | pyqode/python/widgets/interactive.py | def mouseMoveEvent(self, e):
"""
Extends mouseMoveEvent to display a pointing hand cursor when the
mouse cursor is over a file location
"""
super(PyInteractiveConsole, self).mouseMoveEvent(e)
cursor = self.cursorForPosition(e.pos())
assert isinstance(cursor, QtGui... | def mouseMoveEvent(self, e):
"""
Extends mouseMoveEvent to display a pointing hand cursor when the
mouse cursor is over a file location
"""
super(PyInteractiveConsole, self).mouseMoveEvent(e)
cursor = self.cursorForPosition(e.pos())
assert isinstance(cursor, QtGui... | [
"Extends",
"mouseMoveEvent",
"to",
"display",
"a",
"pointing",
"hand",
"cursor",
"when",
"the",
"mouse",
"cursor",
"is",
"over",
"a",
"file",
"location"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/widgets/interactive.py#L97-L113 | [
"def",
"mouseMoveEvent",
"(",
"self",
",",
"e",
")",
":",
"super",
"(",
"PyInteractiveConsole",
",",
"self",
")",
".",
"mouseMoveEvent",
"(",
"e",
")",
"cursor",
"=",
"self",
".",
"cursorForPosition",
"(",
"e",
".",
"pos",
"(",
")",
")",
"assert",
"isi... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PyInteractiveConsole.mousePressEvent | Emits open_file_requested if the press event occured over
a file location string. | pyqode/python/widgets/interactive.py | def mousePressEvent(self, e):
"""
Emits open_file_requested if the press event occured over
a file location string.
"""
super(PyInteractiveConsole, self).mousePressEvent(e)
cursor = self.cursorForPosition(e.pos())
p = cursor.positionInBlock()
usd = cursor... | def mousePressEvent(self, e):
"""
Emits open_file_requested if the press event occured over
a file location string.
"""
super(PyInteractiveConsole, self).mousePressEvent(e)
cursor = self.cursorForPosition(e.pos())
p = cursor.positionInBlock()
usd = cursor... | [
"Emits",
"open_file_requested",
"if",
"the",
"press",
"event",
"occured",
"over",
"a",
"file",
"location",
"string",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/widgets/interactive.py#L115-L126 | [
"def",
"mousePressEvent",
"(",
"self",
",",
"e",
")",
":",
"super",
"(",
"PyInteractiveConsole",
",",
"self",
")",
".",
"mousePressEvent",
"(",
"e",
")",
"cursor",
"=",
"self",
".",
"cursorForPosition",
"(",
"e",
".",
"pos",
"(",
")",
")",
"p",
"=",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | PythonFoldDetector.detect_fold_level | Perfoms fold level detection for current block (take previous block
into account).
:param prev_block: previous block, None if `block` is the first block.
:param block: block to analyse.
:return: block fold level | pyqode/python/folding.py | def detect_fold_level(self, prev_block, block):
"""
Perfoms fold level detection for current block (take previous block
into account).
:param prev_block: previous block, None if `block` is the first block.
:param block: block to analyse.
:return: block fold level
... | def detect_fold_level(self, prev_block, block):
"""
Perfoms fold level detection for current block (take previous block
into account).
:param prev_block: previous block, None if `block` is the first block.
:param block: block to analyse.
:return: block fold level
... | [
"Perfoms",
"fold",
"level",
"detection",
"for",
"current",
"block",
"(",
"take",
"previous",
"block",
"into",
"account",
")",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/folding.py#L63-L85 | [
"def",
"detect_fold_level",
"(",
"self",
",",
"prev_block",
",",
"block",
")",
":",
"# Python is an indent based language so use indentation for folding",
"# makes sense but we restrict new regions to indentation after a ':',",
"# that way only the real logical blocks are displayed.",
"lvl... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.setup_actions | Connects slots to signals | examples/pynotepad/pynotepad/main_window.py | def setup_actions(self):
""" Connects slots to signals """
self.actionOpen.triggered.connect(self.on_open)
self.actionNew.triggered.connect(self.on_new)
self.actionSave.triggered.connect(self.on_save)
self.actionSave_as.triggered.connect(self.on_save_as)
self.actionQuit.t... | def setup_actions(self):
""" Connects slots to signals """
self.actionOpen.triggered.connect(self.on_open)
self.actionNew.triggered.connect(self.on_new)
self.actionSave.triggered.connect(self.on_save)
self.actionSave_as.triggered.connect(self.on_save_as)
self.actionQuit.t... | [
"Connects",
"slots",
"to",
"signals"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L63-L77 | [
"def",
"setup_actions",
"(",
"self",
")",
":",
"self",
".",
"actionOpen",
".",
"triggered",
".",
"connect",
"(",
"self",
".",
"on_open",
")",
"self",
".",
"actionNew",
".",
"triggered",
".",
"connect",
"(",
"self",
".",
"on_new",
")",
"self",
".",
"act... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.setup_editor | Setup the python editor, run the server and connect a few signals.
:param editor: editor to setup. | examples/pynotepad/pynotepad/main_window.py | def setup_editor(self, editor):
"""
Setup the python editor, run the server and connect a few signals.
:param editor: editor to setup.
"""
editor.cursorPositionChanged.connect(self.on_cursor_pos_changed)
try:
m = editor.modes.get(modes.GoToAssignmentsMode)
... | def setup_editor(self, editor):
"""
Setup the python editor, run the server and connect a few signals.
:param editor: editor to setup.
"""
editor.cursorPositionChanged.connect(self.on_cursor_pos_changed)
try:
m = editor.modes.get(modes.GoToAssignmentsMode)
... | [
"Setup",
"the",
"python",
"editor",
"run",
"the",
"server",
"and",
"connect",
"a",
"few",
"signals",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L103-L116 | [
"def",
"setup_editor",
"(",
"self",
",",
"editor",
")",
":",
"editor",
".",
"cursorPositionChanged",
".",
"connect",
"(",
"self",
".",
"on_cursor_pos_changed",
")",
"try",
":",
"m",
"=",
"editor",
".",
"modes",
".",
"get",
"(",
"modes",
".",
"GoToAssignmen... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.open_file | Creates a new GenericCodeEdit, opens the requested file and adds it
to the tab widget.
:param path: Path of the file to open
:return The opened editor if open succeeded. | examples/pynotepad/pynotepad/main_window.py | def open_file(self, path, line=None):
"""
Creates a new GenericCodeEdit, opens the requested file and adds it
to the tab widget.
:param path: Path of the file to open
:return The opened editor if open succeeded.
"""
editor = None
if path:
int... | def open_file(self, path, line=None):
"""
Creates a new GenericCodeEdit, opens the requested file and adds it
to the tab widget.
:param path: Path of the file to open
:return The opened editor if open succeeded.
"""
editor = None
if path:
int... | [
"Creates",
"a",
"new",
"GenericCodeEdit",
"opens",
"the",
"requested",
"file",
"and",
"adds",
"it",
"to",
"the",
"tab",
"widget",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L118-L139 | [
"def",
"open_file",
"(",
"self",
",",
"path",
",",
"line",
"=",
"None",
")",
":",
"editor",
"=",
"None",
"if",
"path",
":",
"interpreter",
",",
"pyserver",
",",
"args",
"=",
"self",
".",
"_get_backend_parameters",
"(",
")",
"editor",
"=",
"self",
".",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow._get_backend_parameters | Gets the pyqode backend parameters (interpreter and script). | examples/pynotepad/pynotepad/main_window.py | def _get_backend_parameters(self):
"""
Gets the pyqode backend parameters (interpreter and script).
"""
frozen = hasattr(sys, 'frozen')
interpreter = Settings().interpreter
if frozen:
interpreter = None
pyserver = server.__file__ if interpreter is not ... | def _get_backend_parameters(self):
"""
Gets the pyqode backend parameters (interpreter and script).
"""
frozen = hasattr(sys, 'frozen')
interpreter = Settings().interpreter
if frozen:
interpreter = None
pyserver = server.__file__ if interpreter is not ... | [
"Gets",
"the",
"pyqode",
"backend",
"parameters",
"(",
"interpreter",
"and",
"script",
")",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L141-L151 | [
"def",
"_get_backend_parameters",
"(",
"self",
")",
":",
"frozen",
"=",
"hasattr",
"(",
"sys",
",",
"'frozen'",
")",
"interpreter",
"=",
"Settings",
"(",
")",
".",
"interpreter",
"if",
"frozen",
":",
"interpreter",
"=",
"None",
"pyserver",
"=",
"server",
"... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.on_new | Add a new empty code editor to the tab widget | examples/pynotepad/pynotepad/main_window.py | def on_new(self):
"""
Add a new empty code editor to the tab widget
"""
interpreter, pyserver, args = self._get_backend_parameters()
self.setup_editor(self.tabWidget.create_new_document(
extension='.py', interpreter=interpreter, server_script=pyserver,
arg... | def on_new(self):
"""
Add a new empty code editor to the tab widget
"""
interpreter, pyserver, args = self._get_backend_parameters()
self.setup_editor(self.tabWidget.create_new_document(
extension='.py', interpreter=interpreter, server_script=pyserver,
arg... | [
"Add",
"a",
"new",
"empty",
"code",
"editor",
"to",
"the",
"tab",
"widget"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L153-L162 | [
"def",
"on_new",
"(",
"self",
")",
":",
"interpreter",
",",
"pyserver",
",",
"args",
"=",
"self",
".",
"_get_backend_parameters",
"(",
")",
"self",
".",
"setup_editor",
"(",
"self",
".",
"tabWidget",
".",
"create_new_document",
"(",
"extension",
"=",
"'.py'"... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.on_open | Shows an open file dialog and open the file if the dialog was
accepted. | examples/pynotepad/pynotepad/main_window.py | def on_open(self):
"""
Shows an open file dialog and open the file if the dialog was
accepted.
"""
filename, filter = QtWidgets.QFileDialog.getOpenFileName(self, 'Open')
if filename:
self.open_file(filename)
self.actionRun.setEnabled(True)
sel... | def on_open(self):
"""
Shows an open file dialog and open the file if the dialog was
accepted.
"""
filename, filter = QtWidgets.QFileDialog.getOpenFileName(self, 'Open')
if filename:
self.open_file(filename)
self.actionRun.setEnabled(True)
sel... | [
"Shows",
"an",
"open",
"file",
"dialog",
"and",
"open",
"the",
"file",
"if",
"the",
"dialog",
"was",
"accepted",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L164-L174 | [
"def",
"on_open",
"(",
"self",
")",
":",
"filename",
",",
"filter",
"=",
"QtWidgets",
".",
"QFileDialog",
".",
"getOpenFileName",
"(",
"self",
",",
"'Open'",
")",
"if",
"filename",
":",
"self",
".",
"open_file",
"(",
"filename",
")",
"self",
".",
"action... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.on_save_as | Save the current editor document as. | examples/pynotepad/pynotepad/main_window.py | def on_save_as(self):
"""
Save the current editor document as.
"""
path = self.tabWidget.current_widget().file.path
path = os.path.dirname(path) if path else ''
filename, filter = QtWidgets.QFileDialog.getSaveFileName(
self, 'Save', path)
if filename:
... | def on_save_as(self):
"""
Save the current editor document as.
"""
path = self.tabWidget.current_widget().file.path
path = os.path.dirname(path) if path else ''
filename, filter = QtWidgets.QFileDialog.getSaveFileName(
self, 'Save', path)
if filename:
... | [
"Save",
"the",
"current",
"editor",
"document",
"as",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L181-L195 | [
"def",
"on_save_as",
"(",
"self",
")",
":",
"path",
"=",
"self",
".",
"tabWidget",
".",
"current_widget",
"(",
")",
".",
"file",
".",
"path",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"if",
"path",
"else",
"''",
"filename",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.setup_mnu_style | setup the style menu for an editor tab | examples/pynotepad/pynotepad/main_window.py | def setup_mnu_style(self, editor):
""" setup the style menu for an editor tab """
menu = QtWidgets.QMenu('Styles', self.menuEdit)
group = QtWidgets.QActionGroup(self)
self.styles_group = group
current_style = editor.syntax_highlighter.color_scheme.name
group.triggered.con... | def setup_mnu_style(self, editor):
""" setup the style menu for an editor tab """
menu = QtWidgets.QMenu('Styles', self.menuEdit)
group = QtWidgets.QActionGroup(self)
self.styles_group = group
current_style = editor.syntax_highlighter.color_scheme.name
group.triggered.con... | [
"setup",
"the",
"style",
"menu",
"for",
"an",
"editor",
"tab"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L208-L223 | [
"def",
"setup_mnu_style",
"(",
"self",
",",
"editor",
")",
":",
"menu",
"=",
"QtWidgets",
".",
"QMenu",
"(",
"'Styles'",
",",
"self",
".",
"menuEdit",
")",
"group",
"=",
"QtWidgets",
".",
"QActionGroup",
"(",
"self",
")",
"self",
".",
"styles_group",
"="... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.setup_mnu_panels | Setup the panels menu for the current editor.
:param editor: | examples/pynotepad/pynotepad/main_window.py | def setup_mnu_panels(self, editor):
"""
Setup the panels menu for the current editor.
:param editor:
"""
for panel in editor.panels:
if panel.dynamic:
continue
a = QtWidgets.QAction(self.menuModes)
a.setText(panel.name)
... | def setup_mnu_panels(self, editor):
"""
Setup the panels menu for the current editor.
:param editor:
"""
for panel in editor.panels:
if panel.dynamic:
continue
a = QtWidgets.QAction(self.menuModes)
a.setText(panel.name)
... | [
"Setup",
"the",
"panels",
"menu",
"for",
"the",
"current",
"editor",
".",
":",
"param",
"editor",
":"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L235-L249 | [
"def",
"setup_mnu_panels",
"(",
"self",
",",
"editor",
")",
":",
"for",
"panel",
"in",
"editor",
".",
"panels",
":",
"if",
"panel",
".",
"dynamic",
":",
"continue",
"a",
"=",
"QtWidgets",
".",
"QAction",
"(",
"self",
".",
"menuModes",
")",
"a",
".",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.on_current_tab_changed | Update action states when the current tab changed. | examples/pynotepad/pynotepad/main_window.py | def on_current_tab_changed(self):
"""
Update action states when the current tab changed.
"""
self.menuEdit.clear()
self.menuModes.clear()
self.menuPanels.clear()
editor = self.tabWidget.current_widget()
self.menuEdit.setEnabled(editor is not None)
... | def on_current_tab_changed(self):
"""
Update action states when the current tab changed.
"""
self.menuEdit.clear()
self.menuModes.clear()
self.menuPanels.clear()
editor = self.tabWidget.current_widget()
self.menuEdit.setEnabled(editor is not None)
... | [
"Update",
"action",
"states",
"when",
"the",
"current",
"tab",
"changed",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L254-L274 | [
"def",
"on_current_tab_changed",
"(",
"self",
")",
":",
"self",
".",
"menuEdit",
".",
"clear",
"(",
")",
"self",
".",
"menuModes",
".",
"clear",
"(",
")",
"self",
".",
"menuPanels",
".",
"clear",
"(",
")",
"editor",
"=",
"self",
".",
"tabWidget",
".",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.on_run | Run the current current script | examples/pynotepad/pynotepad/main_window.py | def on_run(self):
"""
Run the current current script
"""
filename = self.tabWidget.current_widget().file.path
wd = os.path.dirname(filename)
args = Settings().get_run_config_for_file(filename)
self.interactiveConsole.start_process(
Settings().interpret... | def on_run(self):
"""
Run the current current script
"""
filename = self.tabWidget.current_widget().file.path
wd = os.path.dirname(filename)
args = Settings().get_run_config_for_file(filename)
self.interactiveConsole.start_process(
Settings().interpret... | [
"Run",
"the",
"current",
"current",
"script"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L326-L337 | [
"def",
"on_run",
"(",
"self",
")",
":",
"filename",
"=",
"self",
".",
"tabWidget",
".",
"current_widget",
"(",
")",
".",
"file",
".",
"path",
"wd",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"filename",
")",
"args",
"=",
"Settings",
"(",
")",
"."... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | MainWindow.on_goto_out_of_doc | Open the a new tab when goto goes out of the current document.
:param assignment: Destination | examples/pynotepad/pynotepad/main_window.py | def on_goto_out_of_doc(self, assignment):
"""
Open the a new tab when goto goes out of the current document.
:param assignment: Destination
"""
editor = self.open_file(assignment.module_path)
if editor:
TextHelper(editor).goto_line(assignment.line, assignment... | def on_goto_out_of_doc(self, assignment):
"""
Open the a new tab when goto goes out of the current document.
:param assignment: Destination
"""
editor = self.open_file(assignment.module_path)
if editor:
TextHelper(editor).goto_line(assignment.line, assignment... | [
"Open",
"the",
"a",
"new",
"tab",
"when",
"goto",
"goes",
"out",
"of",
"the",
"current",
"document",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/examples/pynotepad/pynotepad/main_window.py#L339-L347 | [
"def",
"on_goto_out_of_doc",
"(",
"self",
",",
"assignment",
")",
":",
"editor",
"=",
"self",
".",
"open_file",
"(",
"assignment",
".",
"module_path",
")",
"if",
"editor",
":",
"TextHelper",
"(",
"editor",
")",
".",
"goto_line",
"(",
"assignment",
".",
"li... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | calltips | Worker that returns a list of calltips.
A calltips is a tuple made of the following parts:
- module_name: name of the module of the function invoked
- call_name: name of the function that is being called
- params: the list of parameter names.
- index: index of the current parameter
- ... | pyqode/python/backend/workers.py | def calltips(request_data):
"""
Worker that returns a list of calltips.
A calltips is a tuple made of the following parts:
- module_name: name of the module of the function invoked
- call_name: name of the function that is being called
- params: the list of parameter names.
- index:... | def calltips(request_data):
"""
Worker that returns a list of calltips.
A calltips is a tuple made of the following parts:
- module_name: name of the module of the function invoked
- call_name: name of the function that is being called
- params: the list of parameter names.
- index:... | [
"Worker",
"that",
"returns",
"a",
"list",
"of",
"calltips",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L21-L50 | [
"def",
"calltips",
"(",
"request_data",
")",
":",
"code",
"=",
"request_data",
"[",
"'code'",
"]",
"line",
"=",
"request_data",
"[",
"'line'",
"]",
"+",
"1",
"column",
"=",
"request_data",
"[",
"'column'",
"]",
"path",
"=",
"request_data",
"[",
"'path'",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | goto_assignments | Go to assignements worker. | pyqode/python/backend/workers.py | def goto_assignments(request_data):
"""
Go to assignements worker.
"""
code = request_data['code']
line = request_data['line'] + 1
column = request_data['column']
path = request_data['path']
# encoding = request_data['encoding']
encoding = 'utf-8'
script = jedi.Script(code, line,... | def goto_assignments(request_data):
"""
Go to assignements worker.
"""
code = request_data['code']
line = request_data['line'] + 1
column = request_data['column']
path = request_data['path']
# encoding = request_data['encoding']
encoding = 'utf-8'
script = jedi.Script(code, line,... | [
"Go",
"to",
"assignements",
"worker",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L53-L72 | [
"def",
"goto_assignments",
"(",
"request_data",
")",
":",
"code",
"=",
"request_data",
"[",
"'code'",
"]",
"line",
"=",
"request_data",
"[",
"'line'",
"]",
"+",
"1",
"column",
"=",
"request_data",
"[",
"'column'",
"]",
"path",
"=",
"request_data",
"[",
"'p... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | defined_names | Returns the list of defined names for the document. | pyqode/python/backend/workers.py | def defined_names(request_data):
"""
Returns the list of defined names for the document.
"""
global _old_definitions
ret_val = []
path = request_data['path']
toplvl_definitions = jedi.names(
request_data['code'], path, 'utf-8')
for d in toplvl_definitions:
definition = _e... | def defined_names(request_data):
"""
Returns the list of defined names for the document.
"""
global _old_definitions
ret_val = []
path = request_data['path']
toplvl_definitions = jedi.names(
request_data['code'], path, 'utf-8')
for d in toplvl_definitions:
definition = _e... | [
"Returns",
"the",
"list",
"of",
"defined",
"names",
"for",
"the",
"document",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L105-L119 | [
"def",
"defined_names",
"(",
"request_data",
")",
":",
"global",
"_old_definitions",
"ret_val",
"=",
"[",
"]",
"path",
"=",
"request_data",
"[",
"'path'",
"]",
"toplvl_definitions",
"=",
"jedi",
".",
"names",
"(",
"request_data",
"[",
"'code'",
"]",
",",
"pa... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | quick_doc | Worker that returns the documentation of the symbol under cursor. | pyqode/python/backend/workers.py | def quick_doc(request_data):
"""
Worker that returns the documentation of the symbol under cursor.
"""
code = request_data['code']
line = request_data['line'] + 1
column = request_data['column']
path = request_data['path']
# encoding = 'utf-8'
encoding = 'utf-8'
script = jedi.Scr... | def quick_doc(request_data):
"""
Worker that returns the documentation of the symbol under cursor.
"""
code = request_data['code']
line = request_data['line'] + 1
column = request_data['column']
path = request_data['path']
# encoding = 'utf-8'
encoding = 'utf-8'
script = jedi.Scr... | [
"Worker",
"that",
"returns",
"the",
"documentation",
"of",
"the",
"symbol",
"under",
"cursor",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L122-L139 | [
"def",
"quick_doc",
"(",
"request_data",
")",
":",
"code",
"=",
"request_data",
"[",
"'code'",
"]",
"line",
"=",
"request_data",
"[",
"'line'",
"]",
"+",
"1",
"column",
"=",
"request_data",
"[",
"'column'",
"]",
"path",
"=",
"request_data",
"[",
"'path'",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | run_pep8 | Worker that run the pep8 tool on the current editor text.
:returns a list of tuples (msg, msg_type, line_number) | pyqode/python/backend/workers.py | def run_pep8(request_data):
"""
Worker that run the pep8 tool on the current editor text.
:returns a list of tuples (msg, msg_type, line_number)
"""
import pycodestyle
from pyqode.python.backend.pep8utils import CustomChecker
WARNING = 1
code = request_data['code']
path = request_da... | def run_pep8(request_data):
"""
Worker that run the pep8 tool on the current editor text.
:returns a list of tuples (msg, msg_type, line_number)
"""
import pycodestyle
from pyqode.python.backend.pep8utils import CustomChecker
WARNING = 1
code = request_data['code']
path = request_da... | [
"Worker",
"that",
"run",
"the",
"pep8",
"tool",
"on",
"the",
"current",
"editor",
"text",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L142-L174 | [
"def",
"run_pep8",
"(",
"request_data",
")",
":",
"import",
"pycodestyle",
"from",
"pyqode",
".",
"python",
".",
"backend",
".",
"pep8utils",
"import",
"CustomChecker",
"WARNING",
"=",
"1",
"code",
"=",
"request_data",
"[",
"'code'",
"]",
"path",
"=",
"reque... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | run_pyflakes | Worker that run a frosted (the fork of pyflakes) code analysis on the
current editor text. | pyqode/python/backend/workers.py | def run_pyflakes(request_data):
"""
Worker that run a frosted (the fork of pyflakes) code analysis on the
current editor text.
"""
global prev_results
from pyflakes import checker
import _ast
WARNING = 1
ERROR = 2
ret_val = []
code = request_data['code']
path = request_da... | def run_pyflakes(request_data):
"""
Worker that run a frosted (the fork of pyflakes) code analysis on the
current editor text.
"""
global prev_results
from pyflakes import checker
import _ast
WARNING = 1
ERROR = 2
ret_val = []
code = request_data['code']
path = request_da... | [
"Worker",
"that",
"run",
"a",
"frosted",
"(",
"the",
"fork",
"of",
"pyflakes",
")",
"code",
"analysis",
"on",
"the",
"current",
"editor",
"text",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L186-L235 | [
"def",
"run_pyflakes",
"(",
"request_data",
")",
":",
"global",
"prev_results",
"from",
"pyflakes",
"import",
"checker",
"import",
"_ast",
"WARNING",
"=",
"1",
"ERROR",
"=",
"2",
"ret_val",
"=",
"[",
"]",
"code",
"=",
"request_data",
"[",
"'code'",
"]",
"p... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | icon_from_typename | Returns the icon resource filename that corresponds to the given typename.
:param name: name of the completion. Use to make the distinction between
public and private completions (using the count of starting '_')
:pram typename: the typename reported by jedi
:returns: The associate icon resource f... | pyqode/python/backend/workers.py | def icon_from_typename(name, icon_type):
"""
Returns the icon resource filename that corresponds to the given typename.
:param name: name of the completion. Use to make the distinction between
public and private completions (using the count of starting '_')
:pram typename: the typename reported... | def icon_from_typename(name, icon_type):
"""
Returns the icon resource filename that corresponds to the given typename.
:param name: name of the completion. Use to make the distinction between
public and private completions (using the count of starting '_')
:pram typename: the typename reported... | [
"Returns",
"the",
"icon",
"resource",
"filename",
"that",
"corresponds",
"to",
"the",
"given",
"typename",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L248-L296 | [
"def",
"icon_from_typename",
"(",
"name",
",",
"icon_type",
")",
":",
"ICONS",
"=",
"{",
"'CLASS'",
":",
"ICON_CLASS",
",",
"'IMPORT'",
":",
"ICON_NAMESPACE",
",",
"'STATEMENT'",
":",
"ICON_VAR",
",",
"'FORFLOW'",
":",
"ICON_VAR",
",",
"'FORSTMT'",
":",
"ICO... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | JediCompletionProvider.complete | Completes python code using `jedi`_.
:returns: a list of completion. | pyqode/python/backend/workers.py | def complete(code, line, column, path, encoding, prefix):
"""
Completes python code using `jedi`_.
:returns: a list of completion.
"""
ret_val = []
try:
script = jedi.Script(code, line + 1, column, path, encoding)
completions = script.completions(... | def complete(code, line, column, path, encoding, prefix):
"""
Completes python code using `jedi`_.
:returns: a list of completion.
"""
ret_val = []
try:
script = jedi.Script(code, line + 1, column, path, encoding)
completions = script.completions(... | [
"Completes",
"python",
"code",
"using",
"jedi",
"_",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/backend/workers.py#L307-L326 | [
"def",
"complete",
"(",
"code",
",",
"line",
",",
"column",
",",
"path",
",",
"encoding",
",",
"prefix",
")",
":",
"ret_val",
"=",
"[",
"]",
"try",
":",
"script",
"=",
"jedi",
".",
"Script",
"(",
"code",
",",
"line",
"+",
"1",
",",
"column",
",",... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | make_python_patterns | Strongly inspired from idlelib.ColorDelegator.make_pat | pyqode/python/modes/sh.py | def make_python_patterns(additional_keywords=[], additional_builtins=[]):
"""Strongly inspired from idlelib.ColorDelegator.make_pat"""
kw = r"\b" + any("keyword", kwlist + additional_keywords) + r"\b"
kw_namespace = r"\b" + any("namespace", kw_namespace_list) + r"\b"
word_operators = r"\b" + any("operat... | def make_python_patterns(additional_keywords=[], additional_builtins=[]):
"""Strongly inspired from idlelib.ColorDelegator.make_pat"""
kw = r"\b" + any("keyword", kwlist + additional_keywords) + r"\b"
kw_namespace = r"\b" + any("namespace", kw_namespace_list) + r"\b"
word_operators = r"\b" + any("operat... | [
"Strongly",
"inspired",
"from",
"idlelib",
".",
"ColorDelegator",
".",
"make_pat"
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/sh.py#L61-L97 | [
"def",
"make_python_patterns",
"(",
"additional_keywords",
"=",
"[",
"]",
",",
"additional_builtins",
"=",
"[",
"]",
")",
":",
"kw",
"=",
"r\"\\b\"",
"+",
"any",
"(",
"\"keyword\"",
",",
"kwlist",
"+",
"additional_keywords",
")",
"+",
"r\"\\b\"",
"kw_namespace... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | GoToAssignmentsMode._check_word_cursor | Request a go to assignment.
:param tc: Text cursor which contains the text that we must look for
its assignment. Can be None to go to the text that is under
the text cursor.
:type tc: QtGui.QTextCursor | pyqode/python/modes/goto_assignements.py | def _check_word_cursor(self, tc=None):
"""
Request a go to assignment.
:param tc: Text cursor which contains the text that we must look for
its assignment. Can be None to go to the text that is under
the text cursor.
:type tc: QtGui.QTextCursor
... | def _check_word_cursor(self, tc=None):
"""
Request a go to assignment.
:param tc: Text cursor which contains the text that we must look for
its assignment. Can be None to go to the text that is under
the text cursor.
:type tc: QtGui.QTextCursor
... | [
"Request",
"a",
"go",
"to",
"assignment",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/goto_assignements.py#L92-L116 | [
"def",
"_check_word_cursor",
"(",
"self",
",",
"tc",
"=",
"None",
")",
":",
"if",
"not",
"tc",
":",
"tc",
"=",
"TextHelper",
"(",
"self",
".",
"editor",
")",
".",
"word_under_cursor",
"(",
")",
"request_data",
"=",
"{",
"'code'",
":",
"self",
".",
"e... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | GoToAssignmentsMode._unique | Not performant but works. | pyqode/python/modes/goto_assignements.py | def _unique(self, seq):
"""
Not performant but works.
"""
# order preserving
checked = []
for e in seq:
present = False
for c in checked:
if str(c) == str(e):
present = True
break
... | def _unique(self, seq):
"""
Not performant but works.
"""
# order preserving
checked = []
for e in seq:
present = False
for c in checked:
if str(c) == str(e):
present = True
break
... | [
"Not",
"performant",
"but",
"works",
"."
] | pyQode/pyqode.python | python | https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/modes/goto_assignements.py#L133-L147 | [
"def",
"_unique",
"(",
"self",
",",
"seq",
")",
":",
"# order preserving",
"checked",
"=",
"[",
"]",
"for",
"e",
"in",
"seq",
":",
"present",
"=",
"False",
"for",
"c",
"in",
"checked",
":",
"if",
"str",
"(",
"c",
")",
"==",
"str",
"(",
"e",
")",
... | 821e000ea2e2638a82ce095a559e69afd9bd4f38 |
valid | read_bgen | r""" Read a given BGEN file.
Parameters
----------
filepath : str
A bgen file path.
metafile_filepath : str, optional
If ``None``, it will try to read the ``filepath + ".metadata"`` file. If this is
not possible, it will create one. It tries to create one at
``filepath +... | bgen_reader/_reader.py | def read_bgen(filepath, metafile_filepath=None, samples_filepath=None, verbose=True):
r""" Read a given BGEN file.
Parameters
----------
filepath : str
A bgen file path.
metafile_filepath : str, optional
If ``None``, it will try to read the ``filepath + ".metadata"`` file. If this i... | def read_bgen(filepath, metafile_filepath=None, samples_filepath=None, verbose=True):
r""" Read a given BGEN file.
Parameters
----------
filepath : str
A bgen file path.
metafile_filepath : str, optional
If ``None``, it will try to read the ``filepath + ".metadata"`` file. If this i... | [
"r",
"Read",
"a",
"given",
"BGEN",
"file",
"."
] | limix/bgen-reader-py | python | https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_reader.py#L16-L87 | [
"def",
"read_bgen",
"(",
"filepath",
",",
"metafile_filepath",
"=",
"None",
",",
"samples_filepath",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"assert_file_exist",
"(",
"filepath",
")",
"assert_file_readable",
"(",
"filepath",
")",
"metafile_filepath",
... | 3f66a39e15a71b981e8c5f887a4adc3ad486a45f |
valid | CheckFileParser._validateDirectives | We should enforce for every CHECK-NOT and CHECK-NOT-L directive that the next directive (if it exists) is
a CHECK or CHECK-L directive | OutputCheck/CheckFileParser.py | def _validateDirectives(self, directiveList, checkFileName):
if len(directiveList) == 0:
raise ParsingException("'{file}' does not contain any CHECK directives".format(file=checkFileName))
from . import Directives
"""
We should enforce for every CHECK-NOT and CHECK-NOT-... | def _validateDirectives(self, directiveList, checkFileName):
if len(directiveList) == 0:
raise ParsingException("'{file}' does not contain any CHECK directives".format(file=checkFileName))
from . import Directives
"""
We should enforce for every CHECK-NOT and CHECK-NOT-... | [
"We",
"should",
"enforce",
"for",
"every",
"CHECK",
"-",
"NOT",
"and",
"CHECK",
"-",
"NOT",
"-",
"L",
"directive",
"that",
"the",
"next",
"directive",
"(",
"if",
"it",
"exists",
")",
"is",
"a",
"CHECK",
"or",
"CHECK",
"-",
"L",
"directive"
] | stp/OutputCheck | python | https://github.com/stp/OutputCheck/blob/eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d/OutputCheck/CheckFileParser.py#L109-L132 | [
"def",
"_validateDirectives",
"(",
"self",
",",
"directiveList",
",",
"checkFileName",
")",
":",
"if",
"len",
"(",
"directiveList",
")",
"==",
"0",
":",
"raise",
"ParsingException",
"(",
"\"'{file}' does not contain any CHECK directives\"",
".",
"format",
"(",
"file... | eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d |
valid | CheckFileParser._substituteCheckPattern | Do various ${} substitutions | OutputCheck/CheckFileParser.py | def _substituteCheckPattern(self, inputString, lineNumber, lastLineNumber, checkFileName, isForRegex):
"""
Do various ${} substitutions
"""
assert isinstance(inputString, str)
assert isinstance(lineNumber, int)
assert isinstance(lastLineNumber, int)
assert isinsta... | def _substituteCheckPattern(self, inputString, lineNumber, lastLineNumber, checkFileName, isForRegex):
"""
Do various ${} substitutions
"""
assert isinstance(inputString, str)
assert isinstance(lineNumber, int)
assert isinstance(lastLineNumber, int)
assert isinsta... | [
"Do",
"various",
"$",
"{}",
"substitutions"
] | stp/OutputCheck | python | https://github.com/stp/OutputCheck/blob/eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d/OutputCheck/CheckFileParser.py#L134-L220 | [
"def",
"_substituteCheckPattern",
"(",
"self",
",",
"inputString",
",",
"lineNumber",
",",
"lastLineNumber",
",",
"checkFileName",
",",
"isForRegex",
")",
":",
"assert",
"isinstance",
"(",
"inputString",
",",
"str",
")",
"assert",
"isinstance",
"(",
"lineNumber",
... | eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d |
valid | create_metafile | r"""Create variants metadata file.
Variants metadata file helps speed up subsequent reads of the associated
bgen file.
Parameters
----------
bgen_filepath : str
Bgen file path.
metafile_file : str
Metafile file path.
verbose : bool
``True`` to show progress; ``False... | bgen_reader/_metadata.py | def create_metafile(bgen_filepath, metafile_filepath, verbose=True):
r"""Create variants metadata file.
Variants metadata file helps speed up subsequent reads of the associated
bgen file.
Parameters
----------
bgen_filepath : str
Bgen file path.
metafile_file : str
Metafile... | def create_metafile(bgen_filepath, metafile_filepath, verbose=True):
r"""Create variants metadata file.
Variants metadata file helps speed up subsequent reads of the associated
bgen file.
Parameters
----------
bgen_filepath : str
Bgen file path.
metafile_file : str
Metafile... | [
"r",
"Create",
"variants",
"metadata",
"file",
"."
] | limix/bgen-reader-py | python | https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_metadata.py#L10-L63 | [
"def",
"create_metafile",
"(",
"bgen_filepath",
",",
"metafile_filepath",
",",
"verbose",
"=",
"True",
")",
":",
"if",
"verbose",
":",
"verbose",
"=",
"1",
"else",
":",
"verbose",
"=",
"0",
"bgen_filepath",
"=",
"make_sure_bytes",
"(",
"bgen_filepath",
")",
... | 3f66a39e15a71b981e8c5f887a4adc3ad486a45f |
valid | CheckLiteral.match | Search through lines for match.
Raise an Exception if fail to match
If match is succesful return the position the match was found | OutputCheck/Directives.py | def match(self, subsetLines, offsetOfSubset, fileName):
"""
Search through lines for match.
Raise an Exception if fail to match
If match is succesful return the position the match was found
"""
for (offset,l) in enumerate(subsetLines):
column = l.... | def match(self, subsetLines, offsetOfSubset, fileName):
"""
Search through lines for match.
Raise an Exception if fail to match
If match is succesful return the position the match was found
"""
for (offset,l) in enumerate(subsetLines):
column = l.... | [
"Search",
"through",
"lines",
"for",
"match",
".",
"Raise",
"an",
"Exception",
"if",
"fail",
"to",
"match",
"If",
"match",
"is",
"succesful",
"return",
"the",
"position",
"the",
"match",
"was",
"found"
] | stp/OutputCheck | python | https://github.com/stp/OutputCheck/blob/eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d/OutputCheck/Directives.py#L108-L126 | [
"def",
"match",
"(",
"self",
",",
"subsetLines",
",",
"offsetOfSubset",
",",
"fileName",
")",
":",
"for",
"(",
"offset",
",",
"l",
")",
"in",
"enumerate",
"(",
"subsetLines",
")",
":",
"column",
"=",
"l",
".",
"find",
"(",
"self",
".",
"literal",
")"... | eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d |
valid | CheckNot.match | Search through lines for match.
Raise an Exception if a match | OutputCheck/Directives.py | def match(self, subsetLines, offsetOfSubset, fileName):
"""
Search through lines for match.
Raise an Exception if a match
"""
for (offset,l) in enumerate(subsetLines):
for t in self.regex:
m = t.Regex.search(l)
if m != None:
... | def match(self, subsetLines, offsetOfSubset, fileName):
"""
Search through lines for match.
Raise an Exception if a match
"""
for (offset,l) in enumerate(subsetLines):
for t in self.regex:
m = t.Regex.search(l)
if m != None:
... | [
"Search",
"through",
"lines",
"for",
"match",
".",
"Raise",
"an",
"Exception",
"if",
"a",
"match"
] | stp/OutputCheck | python | https://github.com/stp/OutputCheck/blob/eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d/OutputCheck/Directives.py#L195-L209 | [
"def",
"match",
"(",
"self",
",",
"subsetLines",
",",
"offsetOfSubset",
",",
"fileName",
")",
":",
"for",
"(",
"offset",
",",
"l",
")",
"in",
"enumerate",
"(",
"subsetLines",
")",
":",
"for",
"t",
"in",
"self",
".",
"regex",
":",
"m",
"=",
"t",
"."... | eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d |
valid | isA | Return true if ``instance`` is an instance of any the Directive
types in ``typeList`` | OutputCheck/Utils.py | def isA(instance, typeList):
"""
Return true if ``instance`` is an instance of any the Directive
types in ``typeList``
"""
return any(map(lambda iType: isinstance(instance,iType), typeList)) | def isA(instance, typeList):
"""
Return true if ``instance`` is an instance of any the Directive
types in ``typeList``
"""
return any(map(lambda iType: isinstance(instance,iType), typeList)) | [
"Return",
"true",
"if",
"instance",
"is",
"an",
"instance",
"of",
"any",
"the",
"Directive",
"types",
"in",
"typeList"
] | stp/OutputCheck | python | https://github.com/stp/OutputCheck/blob/eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d/OutputCheck/Utils.py#L1-L6 | [
"def",
"isA",
"(",
"instance",
",",
"typeList",
")",
":",
"return",
"any",
"(",
"map",
"(",
"lambda",
"iType",
":",
"isinstance",
"(",
"instance",
",",
"iType",
")",
",",
"typeList",
")",
")"
] | eab62a5dd5129f6a4ebfbe4bbe41d35611f7c48d |
valid | _touch | Touch a file.
Credits to <https://stackoverflow.com/a/1160227>. | bgen_reader/_file.py | def _touch(fname, mode=0o666, dir_fd=None, **kwargs):
""" Touch a file.
Credits to <https://stackoverflow.com/a/1160227>.
"""
flags = os.O_CREAT | os.O_APPEND
with os.fdopen(os.open(fname, flags=flags, mode=mode, dir_fd=dir_fd)) as f:
os.utime(
f.fileno() if os.utime in os.suppo... | def _touch(fname, mode=0o666, dir_fd=None, **kwargs):
""" Touch a file.
Credits to <https://stackoverflow.com/a/1160227>.
"""
flags = os.O_CREAT | os.O_APPEND
with os.fdopen(os.open(fname, flags=flags, mode=mode, dir_fd=dir_fd)) as f:
os.utime(
f.fileno() if os.utime in os.suppo... | [
"Touch",
"a",
"file",
"."
] | limix/bgen-reader-py | python | https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_file.py#L36-L47 | [
"def",
"_touch",
"(",
"fname",
",",
"mode",
"=",
"0o666",
",",
"dir_fd",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"flags",
"=",
"os",
".",
"O_CREAT",
"|",
"os",
".",
"O_APPEND",
"with",
"os",
".",
"fdopen",
"(",
"os",
".",
"open",
"(",
"... | 3f66a39e15a71b981e8c5f887a4adc3ad486a45f |
valid | allele_frequency | r""" Compute allele frequency from its expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
Returns
-------
:class:`numpy.ndarray`
Allele frequencies encoded as a variants-by-alleles matrix.
Examples
--------... | bgen_reader/_dosage.py | def allele_frequency(expec):
r""" Compute allele frequency from its expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
Returns
-------
:class:`numpy.ndarray`
Allele frequencies encoded as a variants-by-alleles m... | def allele_frequency(expec):
r""" Compute allele frequency from its expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
Returns
-------
:class:`numpy.ndarray`
Allele frequencies encoded as a variants-by-alleles m... | [
"r",
"Compute",
"allele",
"frequency",
"from",
"its",
"expectation",
"."
] | limix/bgen-reader-py | python | https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_dosage.py#L6-L60 | [
"def",
"allele_frequency",
"(",
"expec",
")",
":",
"expec",
"=",
"asarray",
"(",
"expec",
",",
"float",
")",
"if",
"expec",
".",
"ndim",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"\"Expectation matrix must be bi-dimensional.\"",
")",
"ploidy",
"=",
"expec",
... | 3f66a39e15a71b981e8c5f887a4adc3ad486a45f |
valid | compute_dosage | r""" Compute dosage from allele expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
alt : array_like, optional
Alternative allele index. If ``None``, the allele having the minor
allele frequency for the provided ``exp... | bgen_reader/_dosage.py | def compute_dosage(expec, alt=None):
r""" Compute dosage from allele expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
alt : array_like, optional
Alternative allele index. If ``None``, the allele having the minor
... | def compute_dosage(expec, alt=None):
r""" Compute dosage from allele expectation.
Parameters
----------
expec : array_like
Allele expectations encoded as a samples-by-alleles matrix.
alt : array_like, optional
Alternative allele index. If ``None``, the allele having the minor
... | [
"r",
"Compute",
"dosage",
"from",
"allele",
"expectation",
"."
] | limix/bgen-reader-py | python | https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_dosage.py#L63-L242 | [
"def",
"compute_dosage",
"(",
"expec",
",",
"alt",
"=",
"None",
")",
":",
"if",
"alt",
"is",
"None",
":",
"return",
"expec",
"[",
"...",
",",
"-",
"1",
"]",
"try",
":",
"return",
"expec",
"[",
":",
",",
"alt",
"]",
"except",
"NotImplementedError",
... | 3f66a39e15a71b981e8c5f887a4adc3ad486a45f |
valid | allele_expectation | r""" Allele expectation.
Compute the expectation of each allele from the genotype probabilities.
Parameters
----------
bgen : bgen_file
Bgen file handler.
variant_idx : int
Variant index.
Returns
-------
:class:`numpy.ndarray`
Samples-by-alleles matrix of allel... | bgen_reader/_dosage.py | def allele_expectation(bgen, variant_idx):
r""" Allele expectation.
Compute the expectation of each allele from the genotype probabilities.
Parameters
----------
bgen : bgen_file
Bgen file handler.
variant_idx : int
Variant index.
Returns
-------
:class:`numpy.ndar... | def allele_expectation(bgen, variant_idx):
r""" Allele expectation.
Compute the expectation of each allele from the genotype probabilities.
Parameters
----------
bgen : bgen_file
Bgen file handler.
variant_idx : int
Variant index.
Returns
-------
:class:`numpy.ndar... | [
"r",
"Allele",
"expectation",
"."
] | limix/bgen-reader-py | python | https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/bgen_reader/_dosage.py#L245-L350 | [
"def",
"allele_expectation",
"(",
"bgen",
",",
"variant_idx",
")",
":",
"geno",
"=",
"bgen",
"[",
"\"genotype\"",
"]",
"[",
"variant_idx",
"]",
".",
"compute",
"(",
")",
"if",
"geno",
"[",
"\"phased\"",
"]",
":",
"raise",
"ValueError",
"(",
"\"Allele expec... | 3f66a39e15a71b981e8c5f887a4adc3ad486a45f |
valid | Windows.find_libname | Try to infer the correct library name. | libpath.py | def find_libname(self, name):
"""Try to infer the correct library name."""
names = ["{}.lib", "lib{}.lib", "{}lib.lib"]
names = [n.format(name) for n in names]
dirs = self.get_library_dirs()
for d in dirs:
for n in names:
if exists(join(d, n)):
... | def find_libname(self, name):
"""Try to infer the correct library name."""
names = ["{}.lib", "lib{}.lib", "{}lib.lib"]
names = [n.format(name) for n in names]
dirs = self.get_library_dirs()
for d in dirs:
for n in names:
if exists(join(d, n)):
... | [
"Try",
"to",
"infer",
"the",
"correct",
"library",
"name",
"."
] | limix/bgen-reader-py | python | https://github.com/limix/bgen-reader-py/blob/3f66a39e15a71b981e8c5f887a4adc3ad486a45f/libpath.py#L109-L119 | [
"def",
"find_libname",
"(",
"self",
",",
"name",
")",
":",
"names",
"=",
"[",
"\"{}.lib\"",
",",
"\"lib{}.lib\"",
",",
"\"{}lib.lib\"",
"]",
"names",
"=",
"[",
"n",
".",
"format",
"(",
"name",
")",
"for",
"n",
"in",
"names",
"]",
"dirs",
"=",
"self",... | 3f66a39e15a71b981e8c5f887a4adc3ad486a45f |
valid | LeaveOneGroupOut.split | Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target variable for supervised learning problems.
gro... | CIMtools/model_selection/group_out.py | def split(self, X, y=None, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target va... | def split(self, X, y=None, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target va... | [
"Generate",
"indices",
"to",
"split",
"data",
"into",
"training",
"and",
"test",
"set",
".",
"Parameters",
"----------",
"X",
":",
"array",
"-",
"like",
"of",
"length",
"n_samples",
"Training",
"data",
"includes",
"reaction",
"s",
"containers",
"y",
":",
"ar... | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/model_selection/group_out.py#L54-L92 | [
"def",
"split",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"groups",
"=",
"None",
")",
":",
"X",
",",
"y",
",",
"groups",
"=",
"indexable",
"(",
"X",
",",
"y",
",",
"groups",
")",
"cgrs",
"=",
"[",
"~",
"r",
"for",
"r",
"in",
"X",
... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | molconvert_chemaxon | molconvert wrapper
:param data: buffer or string or path to file
:return: array of molecules of reactions | CIMtools/datasets/molconvert_chemaxon.py | def molconvert_chemaxon(data):
"""
molconvert wrapper
:param data: buffer or string or path to file
:return: array of molecules of reactions
"""
if isinstance(data, Path):
with data.open('rb') as f:
data = f.read()
elif isinstance(data, StringIO):
data = data.read... | def molconvert_chemaxon(data):
"""
molconvert wrapper
:param data: buffer or string or path to file
:return: array of molecules of reactions
"""
if isinstance(data, Path):
with data.open('rb') as f:
data = f.read()
elif isinstance(data, StringIO):
data = data.read... | [
"molconvert",
"wrapper",
":",
"param",
"data",
":",
"buffer",
"or",
"string",
"or",
"path",
"to",
"file",
":",
"return",
":",
"array",
"of",
"molecules",
"of",
"reactions"
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/datasets/molconvert_chemaxon.py#L27-L58 | [
"def",
"molconvert_chemaxon",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"Path",
")",
":",
"with",
"data",
".",
"open",
"(",
"'rb'",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"elif",
"isinstance",
"(",
"data",
... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | SimilarityDistance.fit | Fit distance-based AD.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
Returns
-------
self : object
Returns self. | CIMtools/applicability_domain/similarity_distance.py | def fit(self, X, y=None):
"""Fit distance-based AD.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
Returns
-------
self : object
... | def fit(self, X, y=None):
"""Fit distance-based AD.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
Returns
-------
self : object
... | [
"Fit",
"distance",
"-",
"based",
"AD",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/similarity_distance.py#L105-L158 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Check data",
"X",
"=",
"check_array",
"(",
"X",
")",
"self",
".",
"tree",
"=",
"BallTree",
"(",
"X",
",",
"leaf_size",
"=",
"self",
".",
"leaf_size",
",",
"metric",
"=",
"se... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | SimilarityDistance.predict_proba | Returns the value of the nearest neighbor from the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
... | CIMtools/applicability_domain/similarity_distance.py | def predict_proba(self, X):
"""Returns the value of the nearest neighbor from the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and i... | def predict_proba(self, X):
"""Returns the value of the nearest neighbor from the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and i... | [
"Returns",
"the",
"value",
"of",
"the",
"nearest",
"neighbor",
"from",
"the",
"training",
"set",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/similarity_distance.py#L160-L178 | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"# Check is fit had been called",
"check_is_fitted",
"(",
"self",
",",
"[",
"'tree'",
"]",
")",
"# Check data",
"X",
"=",
"check_array",
"(",
"X",
")",
"return",
"self",
".",
"tree",
".",
"query",
"(... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | SimilarityDistance.predict | Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
to a spar... | CIMtools/applicability_domain/similarity_distance.py | def predict(self, X):
"""Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix ... | def predict(self, X):
"""Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix ... | [
"Predict",
"if",
"a",
"particular",
"sample",
"is",
"an",
"outlier",
"or",
"not",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/similarity_distance.py#L180-L200 | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"# Check is fit had been called",
"check_is_fitted",
"(",
"self",
",",
"[",
"'tree'",
"]",
")",
"# Check data",
"X",
"=",
"check_array",
"(",
"X",
")",
"return",
"self",
".",
"tree",
".",
"query",
"(",
"... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Leverage.fit | Learning is to find the inverse matrix for X and calculate the threshold.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
y : array-like, shape = [n_samples] ... | CIMtools/applicability_domain/leverage.py | def fit(self, X, y=None):
"""Learning is to find the inverse matrix for X and calculate the threshold.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
... | def fit(self, X, y=None):
"""Learning is to find the inverse matrix for X and calculate the threshold.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency.
... | [
"Learning",
"is",
"to",
"find",
"the",
"inverse",
"matrix",
"for",
"X",
"and",
"calculate",
"the",
"threshold",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/leverage.py#L75-L128 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Check that X have correct shape",
"X",
"=",
"check_array",
"(",
"X",
")",
"self",
".",
"inverse_influence_matrix",
"=",
"self",
".",
"__make_inverse_matrix",
"(",
"X",
")",
"if",
"sel... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Leverage.predict_proba | Predict the distances for X to center of the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
to a... | CIMtools/applicability_domain/leverage.py | def predict_proba(self, X):
"""Predict the distances for X to center of the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a spa... | def predict_proba(self, X):
"""Predict the distances for X to center of the training set.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a spa... | [
"Predict",
"the",
"distances",
"for",
"X",
"to",
"center",
"of",
"the",
"training",
"set",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/leverage.py#L130-L149 | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"# Check is fit had been called",
"check_is_fitted",
"(",
"self",
",",
"[",
"'inverse_influence_matrix'",
"]",
")",
"# Check that X have correct shape",
"X",
"=",
"check_array",
"(",
"X",
")",
"return",
"self"... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Leverage.predict | Predict inside or outside AD for X.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
to a sparse ``csr_matrix``.... | CIMtools/applicability_domain/leverage.py | def predict(self, X):
"""Predict inside or outside AD for X.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
... | def predict(self, X):
"""Predict inside or outside AD for X.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
... | [
"Predict",
"inside",
"or",
"outside",
"AD",
"for",
"X",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/leverage.py#L151-L170 | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"# Check is fit had been called",
"check_is_fitted",
"(",
"self",
",",
"[",
"'inverse_influence_matrix'",
"]",
")",
"# Check that X have correct shape",
"X",
"=",
"check_array",
"(",
"X",
")",
"return",
"self",
".... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | ConditionsToDataFrame.get_feature_names | Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform. | CIMtools/conditions_container.py | def get_feature_names(self):
"""Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform.
"""
return ['temperature', 'pressure'] + [f'solvent.{x}' for x in range(1, self.max_solvents + 1)] + \
... | def get_feature_names(self):
"""Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform.
"""
return ['temperature', 'pressure'] + [f'solvent.{x}' for x in range(1, self.max_solvents + 1)] + \
... | [
"Get",
"feature",
"names",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/conditions_container.py#L148-L157 | [
"def",
"get_feature_names",
"(",
"self",
")",
":",
"return",
"[",
"'temperature'",
",",
"'pressure'",
"]",
"+",
"[",
"f'solvent.{x}'",
"for",
"x",
"in",
"range",
"(",
"1",
",",
"self",
".",
"max_solvents",
"+",
"1",
")",
"]",
"+",
"[",
"f'solvent_amount.... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Box.fit | Find min and max values of every feature.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The training input samples.
y : Ignored
not used, present for API consistency by convention.
Returns
-------
se... | CIMtools/applicability_domain/bounding_box.py | def fit(self, X, y=None):
"""Find min and max values of every feature.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The training input samples.
y : Ignored
not used, present for API consistency by convention.
... | def fit(self, X, y=None):
"""Find min and max values of every feature.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The training input samples.
y : Ignored
not used, present for API consistency by convention.
... | [
"Find",
"min",
"and",
"max",
"values",
"of",
"every",
"feature",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/bounding_box.py#L37-L56 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Check that X have correct shape",
"X",
"=",
"check_array",
"(",
"X",
")",
"self",
".",
"_x_min",
"=",
"X",
".",
"min",
"(",
"axis",
"=",
"0",
")",
"# axis=0 will find the minimum va... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Box.predict | Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
to a spars... | CIMtools/applicability_domain/bounding_box.py | def predict(self, X):
""" Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix ... | def predict(self, X):
""" Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix ... | [
"Predict",
"if",
"a",
"particular",
"sample",
"is",
"an",
"outlier",
"or",
"not",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/bounding_box.py#L58-L79 | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"# Check is fit had been called",
"check_is_fitted",
"(",
"self",
",",
"[",
"'_x_min'",
",",
"'_x_max'",
"]",
")",
"# Input validation",
"X",
"=",
"check_array",
"(",
"X",
")",
"return",
"(",
"(",
"X",
"-"... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | TransformationOut.split | Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target variable for supervised learning problems.
gro... | CIMtools/model_selection/transformation_out.py | def split(self, X, y=None, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target va... | def split(self, X, y=None, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like, of length n_samples
Training data, includes reaction's containers
y : array-like, of length n_samples
The target va... | [
"Generate",
"indices",
"to",
"split",
"data",
"into",
"training",
"and",
"test",
"set",
".",
"Parameters",
"----------",
"X",
":",
"array",
"-",
"like",
"of",
"length",
"n_samples",
"Training",
"data",
"includes",
"reaction",
"s",
"containers",
"y",
":",
"ar... | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/model_selection/transformation_out.py#L81-L156 | [
"def",
"split",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"groups",
"=",
"None",
")",
":",
"X",
",",
"y",
",",
"groups",
"=",
"indexable",
"(",
"X",
",",
"y",
",",
"groups",
")",
"cgrs",
"=",
"[",
"~",
"r",
"for",
"r",
"in",
"X",
... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | CIMtoolsTransformerMixin.fit | Do nothing and return the estimator unchanged
This method is just there to implement the usual API and hence work in pipelines. | CIMtools/base.py | def fit(self, x, y=None):
"""Do nothing and return the estimator unchanged
This method is just there to implement the usual API and hence work in pipelines.
"""
if self._dtype is not None:
iter2array(x, dtype=self._dtype)
else:
iter2array(x)
retur... | def fit(self, x, y=None):
"""Do nothing and return the estimator unchanged
This method is just there to implement the usual API and hence work in pipelines.
"""
if self._dtype is not None:
iter2array(x, dtype=self._dtype)
else:
iter2array(x)
retur... | [
"Do",
"nothing",
"and",
"return",
"the",
"estimator",
"unchanged"
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/base.py#L26-L35 | [
"def",
"fit",
"(",
"self",
",",
"x",
",",
"y",
"=",
"None",
")",
":",
"if",
"self",
".",
"_dtype",
"is",
"not",
"None",
":",
"iter2array",
"(",
"x",
",",
"dtype",
"=",
"self",
".",
"_dtype",
")",
"else",
":",
"iter2array",
"(",
"x",
")",
"retur... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Fragmentor.finalize | finalize partial fitting procedure | CIMtools/preprocessing/fragmentor.py | def finalize(self):
"""
finalize partial fitting procedure
"""
if self.__head_less:
warn(f'{self.__class__.__name__} configured to head less mode. finalize unusable')
elif not self.__head_generate:
warn(f'{self.__class__.__name__} already finalized or fitt... | def finalize(self):
"""
finalize partial fitting procedure
"""
if self.__head_less:
warn(f'{self.__class__.__name__} configured to head less mode. finalize unusable')
elif not self.__head_generate:
warn(f'{self.__class__.__name__} already finalized or fitt... | [
"finalize",
"partial",
"fitting",
"procedure"
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/preprocessing/fragmentor.py#L116-L131 | [
"def",
"finalize",
"(",
"self",
")",
":",
"if",
"self",
".",
"__head_less",
":",
"warn",
"(",
"f'{self.__class__.__name__} configured to head less mode. finalize unusable'",
")",
"elif",
"not",
"self",
".",
"__head_generate",
":",
"warn",
"(",
"f'{self.__class__.__name_... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Fragmentor._reset | Reset internal data-dependent state.
__init__ parameters are not touched. | CIMtools/preprocessing/fragmentor.py | def _reset(self):
"""Reset internal data-dependent state.
__init__ parameters are not touched.
"""
if not self.__head_less:
if not self.__head_generate:
self.__head_generate = True
if self.__head_dict:
self.__head_dump = self.__head... | def _reset(self):
"""Reset internal data-dependent state.
__init__ parameters are not touched.
"""
if not self.__head_less:
if not self.__head_generate:
self.__head_generate = True
if self.__head_dict:
self.__head_dump = self.__head... | [
"Reset",
"internal",
"data",
"-",
"dependent",
"state",
".",
"__init__",
"parameters",
"are",
"not",
"touched",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/preprocessing/fragmentor.py#L133-L145 | [
"def",
"_reset",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__head_less",
":",
"if",
"not",
"self",
".",
"__head_generate",
":",
"self",
".",
"__head_generate",
"=",
"True",
"if",
"self",
".",
"__head_dict",
":",
"self",
".",
"__head_dump",
"=",
... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Fragmentor.get_feature_names | Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform. | CIMtools/preprocessing/fragmentor.py | def get_feature_names(self):
"""Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform.
"""
if self.__head_less:
raise AttributeError(f'{self.__class__.__name__} instance configured to head l... | def get_feature_names(self):
"""Get feature names.
Returns
-------
feature_names : list of strings
Names of the features produced by transform.
"""
if self.__head_less:
raise AttributeError(f'{self.__class__.__name__} instance configured to head l... | [
"Get",
"feature",
"names",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/preprocessing/fragmentor.py#L147-L159 | [
"def",
"get_feature_names",
"(",
"self",
")",
":",
"if",
"self",
".",
"__head_less",
":",
"raise",
"AttributeError",
"(",
"f'{self.__class__.__name__} instance configured to head less mode'",
")",
"elif",
"not",
"self",
".",
"__head_dict",
":",
"raise",
"NotFittedError"... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Fragmentor.fit | Compute the header. | CIMtools/preprocessing/fragmentor.py | def fit(self, x, y=None):
"""Compute the header.
"""
x = iter2array(x, dtype=(MoleculeContainer, CGRContainer))
if self.__head_less:
warn(f'{self.__class__.__name__} configured to head less mode. fit unusable')
return self
self._reset()
self.__pr... | def fit(self, x, y=None):
"""Compute the header.
"""
x = iter2array(x, dtype=(MoleculeContainer, CGRContainer))
if self.__head_less:
warn(f'{self.__class__.__name__} configured to head less mode. fit unusable')
return self
self._reset()
self.__pr... | [
"Compute",
"the",
"header",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/preprocessing/fragmentor.py#L161-L172 | [
"def",
"fit",
"(",
"self",
",",
"x",
",",
"y",
"=",
"None",
")",
":",
"x",
"=",
"iter2array",
"(",
"x",
",",
"dtype",
"=",
"(",
"MoleculeContainer",
",",
"CGRContainer",
")",
")",
"if",
"self",
".",
"__head_less",
":",
"warn",
"(",
"f'{self.__class__... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | ReactionTypeControl.fit | Fit structure-based AD. The training model memorizes the unique set of reaction signature.
Parameters
----------
X : after read rdf file
Returns
-------
self : object | CIMtools/applicability_domain/reaction_type_control.py | def fit(self, X):
"""Fit structure-based AD. The training model memorizes the unique set of reaction signature.
Parameters
----------
X : after read rdf file
Returns
-------
self : object
"""
X = iter2array(X, dtype=ReactionContainer)
se... | def fit(self, X):
"""Fit structure-based AD. The training model memorizes the unique set of reaction signature.
Parameters
----------
X : after read rdf file
Returns
-------
self : object
"""
X = iter2array(X, dtype=ReactionContainer)
se... | [
"Fit",
"structure",
"-",
"based",
"AD",
".",
"The",
"training",
"model",
"memorizes",
"the",
"unique",
"set",
"of",
"reaction",
"signature",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/reaction_type_control.py#L51-L64 | [
"def",
"fit",
"(",
"self",
",",
"X",
")",
":",
"X",
"=",
"iter2array",
"(",
"X",
",",
"dtype",
"=",
"ReactionContainer",
")",
"self",
".",
"_train_signatures",
"=",
"{",
"self",
".",
"__get_signature",
"(",
"x",
")",
"for",
"x",
"in",
"X",
"}",
"re... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | ReactionTypeControl.predict | Reaction is considered belonging to model’s AD
if its reaction signature coincides with ones used in training set.
Parameters
----------
X : after read rdf file
Returns
-------
self : array contains True (reaction in AD) and False (reaction residing outside AD). | CIMtools/applicability_domain/reaction_type_control.py | def predict(self, X):
"""Reaction is considered belonging to model’s AD
if its reaction signature coincides with ones used in training set.
Parameters
----------
X : after read rdf file
Returns
-------
self : array contains True (reaction in AD) and Fals... | def predict(self, X):
"""Reaction is considered belonging to model’s AD
if its reaction signature coincides with ones used in training set.
Parameters
----------
X : after read rdf file
Returns
-------
self : array contains True (reaction in AD) and Fals... | [
"Reaction",
"is",
"considered",
"belonging",
"to",
"model’s",
"AD",
"if",
"its",
"reaction",
"signature",
"coincides",
"with",
"ones",
"used",
"in",
"training",
"set",
"."
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/applicability_domain/reaction_type_control.py#L66-L80 | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"check_is_fitted",
"(",
"self",
",",
"[",
"'_train_signatures'",
"]",
")",
"X",
"=",
"iter2array",
"(",
"X",
",",
"dtype",
"=",
"ReactionContainer",
")",
"return",
"array",
"(",
"[",
"self",
".",
"__ge... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | Eval.__parser | adopted from Paul McGuire example. http://pyparsing.wikispaces.com/file/view/fourFn.py | CIMtools/preprocessing/equation.py | def __parser(expression):
""" adopted from Paul McGuire example. http://pyparsing.wikispaces.com/file/view/fourFn.py
"""
expr_stack = []
def push_first(strg, loc, toks):
expr_stack.append(toks[0])
def push_u_minus(strg, loc, toks):
if toks and toks[0] ==... | def __parser(expression):
""" adopted from Paul McGuire example. http://pyparsing.wikispaces.com/file/view/fourFn.py
"""
expr_stack = []
def push_first(strg, loc, toks):
expr_stack.append(toks[0])
def push_u_minus(strg, loc, toks):
if toks and toks[0] ==... | [
"adopted",
"from",
"Paul",
"McGuire",
"example",
".",
"http",
":",
"//",
"pyparsing",
".",
"wikispaces",
".",
"com",
"/",
"file",
"/",
"view",
"/",
"fourFn",
".",
"py"
] | stsouko/CIMtools | python | https://github.com/stsouko/CIMtools/blob/cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3/CIMtools/preprocessing/equation.py#L58-L100 | [
"def",
"__parser",
"(",
"expression",
")",
":",
"expr_stack",
"=",
"[",
"]",
"def",
"push_first",
"(",
"strg",
",",
"loc",
",",
"toks",
")",
":",
"expr_stack",
".",
"append",
"(",
"toks",
"[",
"0",
"]",
")",
"def",
"push_u_minus",
"(",
"strg",
",",
... | cbb46e68eaa1fe7e7b6cb311fc7063e97096bdf3 |
valid | from_int | :params data: integer
:returns: proquint made from input data
:type data: int
:rtype: string | morango/utils/proquint.py | def from_int(data):
"""
:params data: integer
:returns: proquint made from input data
:type data: int
:rtype: string
"""
if not isinstance(data, int) and not isinstance(data, long):
raise TypeError('Input must be integer')
res = []
while data > 0 or not res:
for j in... | def from_int(data):
"""
:params data: integer
:returns: proquint made from input data
:type data: int
:rtype: string
"""
if not isinstance(data, int) and not isinstance(data, long):
raise TypeError('Input must be integer')
res = []
while data > 0 or not res:
for j in... | [
":",
"params",
"data",
":",
"integer",
":",
"returns",
":",
"proquint",
"made",
"from",
"input",
"data",
":",
"type",
"data",
":",
"int",
":",
"rtype",
":",
"string"
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/proquint.py#L57-L79 | [
"def",
"from_int",
"(",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"int",
")",
"and",
"not",
"isinstance",
"(",
"data",
",",
"long",
")",
":",
"raise",
"TypeError",
"(",
"'Input must be integer'",
")",
"res",
"=",
"[",
"]",
"while",... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | to_int | :params data: proquint
:returns: proquint decoded into an integer
:type data: string
:rtype: int | morango/utils/proquint.py | def to_int(data):
"""
:params data: proquint
:returns: proquint decoded into an integer
:type data: string
:rtype: int
"""
if not isinstance(data, basestring):
raise TypeError('Input must be string')
res = 0
for part in data.split('-'):
if len(part) != 5:
... | def to_int(data):
"""
:params data: proquint
:returns: proquint decoded into an integer
:type data: string
:rtype: int
"""
if not isinstance(data, basestring):
raise TypeError('Input must be string')
res = 0
for part in data.split('-'):
if len(part) != 5:
... | [
":",
"params",
"data",
":",
"proquint",
":",
"returns",
":",
"proquint",
"decoded",
"into",
"an",
"integer",
":",
"type",
"data",
":",
"string",
":",
"rtype",
":",
"int"
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/proquint.py#L82-L106 | [
"def",
"to_int",
"(",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"basestring",
")",
":",
"raise",
"TypeError",
"(",
"'Input must be string'",
")",
"res",
"=",
"0",
"for",
"part",
"in",
"data",
".",
"split",
"(",
"'-'",
")",
":",
"... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | SharedKey.get_or_create_shared_key | Create a shared public/private key pair for certificate pushing,
if the settings allow. | morango/crypto.py | def get_or_create_shared_key(cls, force_new=False):
"""
Create a shared public/private key pair for certificate pushing,
if the settings allow.
"""
if force_new:
with transaction.atomic():
SharedKey.objects.filter(current=True).update(current=False)
... | def get_or_create_shared_key(cls, force_new=False):
"""
Create a shared public/private key pair for certificate pushing,
if the settings allow.
"""
if force_new:
with transaction.atomic():
SharedKey.objects.filter(current=True).update(current=False)
... | [
"Create",
"a",
"shared",
"public",
"/",
"private",
"key",
"pair",
"for",
"certificate",
"pushing",
"if",
"the",
"settings",
"allow",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/crypto.py#L359-L378 | [
"def",
"get_or_create_shared_key",
"(",
"cls",
",",
"force_new",
"=",
"False",
")",
":",
"if",
"force_new",
":",
"with",
"transaction",
".",
"atomic",
"(",
")",
":",
"SharedKey",
".",
"objects",
".",
"filter",
"(",
"current",
"=",
"True",
")",
".",
"upda... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | _self_referential_fk | Return whether this model has a self ref FK, and the name for the field | morango/controller.py | def _self_referential_fk(klass_model):
"""
Return whether this model has a self ref FK, and the name for the field
"""
for f in klass_model._meta.concrete_fields:
if f.related_model:
if issubclass(klass_model, f.related_model):
return f.attname
return None | def _self_referential_fk(klass_model):
"""
Return whether this model has a self ref FK, and the name for the field
"""
for f in klass_model._meta.concrete_fields:
if f.related_model:
if issubclass(klass_model, f.related_model):
return f.attname
return None | [
"Return",
"whether",
"this",
"model",
"has",
"a",
"self",
"ref",
"FK",
"and",
"the",
"name",
"for",
"the",
"field"
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/controller.py#L5-L13 | [
"def",
"_self_referential_fk",
"(",
"klass_model",
")",
":",
"for",
"f",
"in",
"klass_model",
".",
"_meta",
".",
"concrete_fields",
":",
"if",
"f",
".",
"related_model",
":",
"if",
"issubclass",
"(",
"klass_model",
",",
"f",
".",
"related_model",
")",
":",
... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | InstanceIDModel.get_or_create_current_instance | Get the instance model corresponding to the current system, or create a new
one if the system is new or its properties have changed (e.g. OS from upgrade). | morango/models.py | def get_or_create_current_instance(cls):
"""Get the instance model corresponding to the current system, or create a new
one if the system is new or its properties have changed (e.g. OS from upgrade)."""
# on Android, platform.platform() barfs, so we handle that safely here
try:
... | def get_or_create_current_instance(cls):
"""Get the instance model corresponding to the current system, or create a new
one if the system is new or its properties have changed (e.g. OS from upgrade)."""
# on Android, platform.platform() barfs, so we handle that safely here
try:
... | [
"Get",
"the",
"instance",
"model",
"corresponding",
"to",
"the",
"current",
"system",
"or",
"create",
"a",
"new",
"one",
"if",
"the",
"system",
"is",
"new",
"or",
"its",
"properties",
"have",
"changed",
"(",
"e",
".",
"g",
".",
"OS",
"from",
"upgrade",
... | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/models.py#L100-L134 | [
"def",
"get_or_create_current_instance",
"(",
"cls",
")",
":",
"# on Android, platform.platform() barfs, so we handle that safely here",
"try",
":",
"plat",
"=",
"platform",
".",
"platform",
"(",
")",
"except",
":",
"plat",
"=",
"\"Unknown (Android?)\"",
"kwargs",
"=",
... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | Store._deserialize_store_model | When deserializing a store model, we look at the deleted flags to know if we should delete the app model.
Upon loading the app model in memory we validate the app models fields, if any errors occurs we follow
foreign key relationships to see if the related model has been deleted to propagate that deleti... | morango/models.py | def _deserialize_store_model(self, fk_cache):
"""
When deserializing a store model, we look at the deleted flags to know if we should delete the app model.
Upon loading the app model in memory we validate the app models fields, if any errors occurs we follow
foreign key relationships to ... | def _deserialize_store_model(self, fk_cache):
"""
When deserializing a store model, we look at the deleted flags to know if we should delete the app model.
Upon loading the app model in memory we validate the app models fields, if any errors occurs we follow
foreign key relationships to ... | [
"When",
"deserializing",
"a",
"store",
"model",
"we",
"look",
"at",
"the",
"deleted",
"flags",
"to",
"know",
"if",
"we",
"should",
"delete",
"the",
"app",
"model",
".",
"Upon",
"loading",
"the",
"app",
"model",
"in",
"memory",
"we",
"validate",
"the",
"a... | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/models.py#L288-L335 | [
"def",
"_deserialize_store_model",
"(",
"self",
",",
"fk_cache",
")",
":",
"klass_model",
"=",
"_profile_models",
"[",
"self",
".",
"profile",
"]",
"[",
"self",
".",
"model_name",
"]",
"# if store model marked as deleted, attempt to delete in app layer",
"if",
"self",
... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | SyncableModel.serialize | All concrete fields of the ``SyncableModel`` subclass, except for those specifically blacklisted, are returned in a dict. | morango/models.py | def serialize(self):
"""All concrete fields of the ``SyncableModel`` subclass, except for those specifically blacklisted, are returned in a dict."""
# NOTE: code adapted from https://github.com/django/django/blob/master/django/forms/models.py#L75
opts = self._meta
data = {}
for ... | def serialize(self):
"""All concrete fields of the ``SyncableModel`` subclass, except for those specifically blacklisted, are returned in a dict."""
# NOTE: code adapted from https://github.com/django/django/blob/master/django/forms/models.py#L75
opts = self._meta
data = {}
for ... | [
"All",
"concrete",
"fields",
"of",
"the",
"SyncableModel",
"subclass",
"except",
"for",
"those",
"specifically",
"blacklisted",
"are",
"returned",
"in",
"a",
"dict",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/models.py#L528-L546 | [
"def",
"serialize",
"(",
"self",
")",
":",
"# NOTE: code adapted from https://github.com/django/django/blob/master/django/forms/models.py#L75",
"opts",
"=",
"self",
".",
"_meta",
"data",
"=",
"{",
"}",
"for",
"f",
"in",
"opts",
".",
"concrete_fields",
":",
"if",
"f",
... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | SyncableModel.deserialize | Returns an unsaved class object based on the valid properties passed in. | morango/models.py | def deserialize(cls, dict_model):
"""Returns an unsaved class object based on the valid properties passed in."""
kwargs = {}
for f in cls._meta.concrete_fields:
if f.attname in dict_model:
kwargs[f.attname] = dict_model[f.attname]
return cls(**kwargs) | def deserialize(cls, dict_model):
"""Returns an unsaved class object based on the valid properties passed in."""
kwargs = {}
for f in cls._meta.concrete_fields:
if f.attname in dict_model:
kwargs[f.attname] = dict_model[f.attname]
return cls(**kwargs) | [
"Returns",
"an",
"unsaved",
"class",
"object",
"based",
"on",
"the",
"valid",
"properties",
"passed",
"in",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/models.py#L549-L555 | [
"def",
"deserialize",
"(",
"cls",
",",
"dict_model",
")",
":",
"kwargs",
"=",
"{",
"}",
"for",
"f",
"in",
"cls",
".",
"_meta",
".",
"concrete_fields",
":",
"if",
"f",
".",
"attname",
"in",
"dict_model",
":",
"kwargs",
"[",
"f",
".",
"attname",
"]",
... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | UUIDField.get_default | Returns the default value for this field. | morango/utils/uuids.py | def get_default(self):
"""
Returns the default value for this field.
"""
if self.has_default():
if callable(self.default):
default = self.default()
if isinstance(default, uuid.UUID):
return default.hex
return... | def get_default(self):
"""
Returns the default value for this field.
"""
if self.has_default():
if callable(self.default):
default = self.default()
if isinstance(default, uuid.UUID):
return default.hex
return... | [
"Returns",
"the",
"default",
"value",
"for",
"this",
"field",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/uuids.py#L51-L64 | [
"def",
"get_default",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_default",
"(",
")",
":",
"if",
"callable",
"(",
"self",
".",
"default",
")",
":",
"default",
"=",
"self",
".",
"default",
"(",
")",
"if",
"isinstance",
"(",
"default",
",",
"uuid",
... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | UUIDModelMixin.calculate_uuid | Should return a 32-digit hex string for a UUID that is calculated as a function of a set of fields from the model. | morango/utils/uuids.py | def calculate_uuid(self):
"""Should return a 32-digit hex string for a UUID that is calculated as a function of a set of fields from the model."""
# raise an error if no inputs to the UUID calculation were specified
if self.uuid_input_fields is None:
raise NotImplementedError("""You... | def calculate_uuid(self):
"""Should return a 32-digit hex string for a UUID that is calculated as a function of a set of fields from the model."""
# raise an error if no inputs to the UUID calculation were specified
if self.uuid_input_fields is None:
raise NotImplementedError("""You... | [
"Should",
"return",
"a",
"32",
"-",
"digit",
"hex",
"string",
"for",
"a",
"UUID",
"that",
"is",
"calculated",
"as",
"a",
"function",
"of",
"a",
"set",
"of",
"fields",
"from",
"the",
"model",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/uuids.py#L82-L112 | [
"def",
"calculate_uuid",
"(",
"self",
")",
":",
"# raise an error if no inputs to the UUID calculation were specified",
"if",
"self",
".",
"uuid_input_fields",
"is",
"None",
":",
"raise",
"NotImplementedError",
"(",
"\"\"\"You must define either a 'uuid_input_fields' attribute\n ... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | add_to_deleted_models | Whenever a model is deleted, we record its ID in a separate model for tracking purposes. During serialization, we will mark
the model as deleted in the store. | morango/signals.py | def add_to_deleted_models(sender, instance=None, *args, **kwargs):
"""
Whenever a model is deleted, we record its ID in a separate model for tracking purposes. During serialization, we will mark
the model as deleted in the store.
"""
if issubclass(sender, SyncableModel):
instance._update_del... | def add_to_deleted_models(sender, instance=None, *args, **kwargs):
"""
Whenever a model is deleted, we record its ID in a separate model for tracking purposes. During serialization, we will mark
the model as deleted in the store.
"""
if issubclass(sender, SyncableModel):
instance._update_del... | [
"Whenever",
"a",
"model",
"is",
"deleted",
"we",
"record",
"its",
"ID",
"in",
"a",
"separate",
"model",
"for",
"tracking",
"purposes",
".",
"During",
"serialization",
"we",
"will",
"mark",
"the",
"model",
"as",
"deleted",
"in",
"the",
"store",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/signals.py#L8-L14 | [
"def",
"add_to_deleted_models",
"(",
"sender",
",",
"instance",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"issubclass",
"(",
"sender",
",",
"SyncableModel",
")",
":",
"instance",
".",
"_update_deleted_models",
"(",
")"
] | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | APIWrapper.make_request | Reusable method for performing requests.
:param url - URL to request
:param method - request method, default is 'get'
:param headers - request headers
:param data - post data
:param callback - callback to be applied to response,
default callback will par... | apiwrapper/apiwrapper.py | def make_request(self, url, method='get', headers=None, data=None,
callback=None, errors=STRICT, verify=False, timeout=None, **params):
"""
Reusable method for performing requests.
:param url - URL to request
:param method - request method, default is 'get'
:... | def make_request(self, url, method='get', headers=None, data=None,
callback=None, errors=STRICT, verify=False, timeout=None, **params):
"""
Reusable method for performing requests.
:param url - URL to request
:param method - request method, default is 'get'
:... | [
"Reusable",
"method",
"for",
"performing",
"requests",
".",
":",
"param",
"url",
"-",
"URL",
"to",
"request",
":",
"param",
"method",
"-",
"request",
"method",
"default",
"is",
"get",
":",
"param",
"headers",
"-",
"request",
"headers",
":",
"param",
"data"... | ardydedase/apiwrapper | python | https://github.com/ardydedase/apiwrapper/blob/dd477e9f6fc5706b7a29c61a466cd63427d7c517/apiwrapper/apiwrapper.py#L89-L143 | [
"def",
"make_request",
"(",
"self",
",",
"url",
",",
"method",
"=",
"'get'",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"errors",
"=",
"STRICT",
",",
"verify",
"=",
"False",
",",
"timeout",
"=",
"None",
... | dd477e9f6fc5706b7a29c61a466cd63427d7c517 |
valid | APIWrapper._with_error_handling | Static method for error handling.
:param resp - API response
:param error - Error thrown
:param mode - Error mode
:param response_format - XML or json | apiwrapper/apiwrapper.py | def _with_error_handling(resp, error, mode, response_format):
"""
Static method for error handling.
:param resp - API response
:param error - Error thrown
:param mode - Error mode
:param response_format - XML or json
"""
def safe_parse(r):
try... | def _with_error_handling(resp, error, mode, response_format):
"""
Static method for error handling.
:param resp - API response
:param error - Error thrown
:param mode - Error mode
:param response_format - XML or json
"""
def safe_parse(r):
try... | [
"Static",
"method",
"for",
"error",
"handling",
"."
] | ardydedase/apiwrapper | python | https://github.com/ardydedase/apiwrapper/blob/dd477e9f6fc5706b7a29c61a466cd63427d7c517/apiwrapper/apiwrapper.py#L155-L219 | [
"def",
"_with_error_handling",
"(",
"resp",
",",
"error",
",",
"mode",
",",
"response_format",
")",
":",
"def",
"safe_parse",
"(",
"r",
")",
":",
"try",
":",
"return",
"APIWrapper",
".",
"_parse_resp",
"(",
"r",
",",
"response_format",
")",
"except",
"(",
... | dd477e9f6fc5706b7a29c61a466cd63427d7c517 |
valid | APIWrapper.poll | Poll the URL
:param url - URL to poll, should be returned by 'create_session' call
:param initial_delay - specifies how many seconds to wait before the first poll
:param delay - specifies how many seconds to wait between the polls
:param tries - number of polls to perform
:param ... | apiwrapper/apiwrapper.py | def poll(self, url, initial_delay=2, delay=1, tries=20, errors=STRICT, is_complete_callback=None, **params):
"""
Poll the URL
:param url - URL to poll, should be returned by 'create_session' call
:param initial_delay - specifies how many seconds to wait before the first poll
:par... | def poll(self, url, initial_delay=2, delay=1, tries=20, errors=STRICT, is_complete_callback=None, **params):
"""
Poll the URL
:param url - URL to poll, should be returned by 'create_session' call
:param initial_delay - specifies how many seconds to wait before the first poll
:par... | [
"Poll",
"the",
"URL",
":",
"param",
"url",
"-",
"URL",
"to",
"poll",
"should",
"be",
"returned",
"by",
"create_session",
"call",
":",
"param",
"initial_delay",
"-",
"specifies",
"how",
"many",
"seconds",
"to",
"wait",
"before",
"the",
"first",
"poll",
":",... | ardydedase/apiwrapper | python | https://github.com/ardydedase/apiwrapper/blob/dd477e9f6fc5706b7a29c61a466cd63427d7c517/apiwrapper/apiwrapper.py#L221-L250 | [
"def",
"poll",
"(",
"self",
",",
"url",
",",
"initial_delay",
"=",
"2",
",",
"delay",
"=",
"1",
",",
"tries",
"=",
"20",
",",
"errors",
"=",
"STRICT",
",",
"is_complete_callback",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"time",
".",
"sleep"... | dd477e9f6fc5706b7a29c61a466cd63427d7c517 |
valid | APIWrapper._default_poll_callback | Checks the condition in poll response to determine if it is complete
and no subsequent poll requests should be done. | apiwrapper/apiwrapper.py | def _default_poll_callback(self, poll_resp):
"""
Checks the condition in poll response to determine if it is complete
and no subsequent poll requests should be done.
"""
if poll_resp.parsed is None:
return False
success_list = ['UpdatesComplete', True, 'COMPLE... | def _default_poll_callback(self, poll_resp):
"""
Checks the condition in poll response to determine if it is complete
and no subsequent poll requests should be done.
"""
if poll_resp.parsed is None:
return False
success_list = ['UpdatesComplete', True, 'COMPLE... | [
"Checks",
"the",
"condition",
"in",
"poll",
"response",
"to",
"determine",
"if",
"it",
"is",
"complete",
"and",
"no",
"subsequent",
"poll",
"requests",
"should",
"be",
"done",
"."
] | ardydedase/apiwrapper | python | https://github.com/ardydedase/apiwrapper/blob/dd477e9f6fc5706b7a29c61a466cd63427d7c517/apiwrapper/apiwrapper.py#L252-L268 | [
"def",
"_default_poll_callback",
"(",
"self",
",",
"poll_resp",
")",
":",
"if",
"poll_resp",
".",
"parsed",
"is",
"None",
":",
"return",
"False",
"success_list",
"=",
"[",
"'UpdatesComplete'",
",",
"True",
",",
"'COMPLETE'",
"]",
"status",
"=",
"None",
"if",... | dd477e9f6fc5706b7a29c61a466cd63427d7c517 |
valid | _fsic_queuing_calc | We set the lower counter between two same instance ids.
If an instance_id exists in one fsic but not the other we want to give that counter a value of 0.
:param fsic1: dictionary containing (instance_id, counter) pairs
:param fsic2: dictionary containing (instance_id, counter) pairs
:return ``dict`` of... | morango/utils/sync_utils.py | def _fsic_queuing_calc(fsic1, fsic2):
"""
We set the lower counter between two same instance ids.
If an instance_id exists in one fsic but not the other we want to give that counter a value of 0.
:param fsic1: dictionary containing (instance_id, counter) pairs
:param fsic2: dictionary containing (i... | def _fsic_queuing_calc(fsic1, fsic2):
"""
We set the lower counter between two same instance ids.
If an instance_id exists in one fsic but not the other we want to give that counter a value of 0.
:param fsic1: dictionary containing (instance_id, counter) pairs
:param fsic2: dictionary containing (i... | [
"We",
"set",
"the",
"lower",
"counter",
"between",
"two",
"same",
"instance",
"ids",
".",
"If",
"an",
"instance_id",
"exists",
"in",
"one",
"fsic",
"but",
"not",
"the",
"other",
"we",
"want",
"to",
"give",
"that",
"counter",
"a",
"value",
"of",
"0",
".... | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/sync_utils.py#L38-L47 | [
"def",
"_fsic_queuing_calc",
"(",
"fsic1",
",",
"fsic2",
")",
":",
"return",
"{",
"instance",
":",
"fsic2",
".",
"get",
"(",
"instance",
",",
"0",
")",
"for",
"instance",
",",
"counter",
"in",
"six",
".",
"iteritems",
"(",
"fsic1",
")",
"if",
"fsic2",
... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | _serialize_into_store | Takes data from app layer and serializes the models into the store. | morango/utils/sync_utils.py | def _serialize_into_store(profile, filter=None):
"""
Takes data from app layer and serializes the models into the store.
"""
# ensure that we write and retrieve the counter in one go for consistency
current_id = InstanceIDModel.get_current_instance_and_increment_counter()
with transaction.atomi... | def _serialize_into_store(profile, filter=None):
"""
Takes data from app layer and serializes the models into the store.
"""
# ensure that we write and retrieve the counter in one go for consistency
current_id = InstanceIDModel.get_current_instance_and_increment_counter()
with transaction.atomi... | [
"Takes",
"data",
"from",
"app",
"layer",
"and",
"serializes",
"the",
"models",
"into",
"the",
"store",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/sync_utils.py#L49-L152 | [
"def",
"_serialize_into_store",
"(",
"profile",
",",
"filter",
"=",
"None",
")",
":",
"# ensure that we write and retrieve the counter in one go for consistency",
"current_id",
"=",
"InstanceIDModel",
".",
"get_current_instance_and_increment_counter",
"(",
")",
"with",
"transac... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | _deserialize_from_store | Takes data from the store and integrates into the application. | morango/utils/sync_utils.py | def _deserialize_from_store(profile):
"""
Takes data from the store and integrates into the application.
"""
# we first serialize to avoid deserialization merge conflicts
_serialize_into_store(profile)
fk_cache = {}
with transaction.atomic():
syncable_dict = _profile_models[profile]... | def _deserialize_from_store(profile):
"""
Takes data from the store and integrates into the application.
"""
# we first serialize to avoid deserialization merge conflicts
_serialize_into_store(profile)
fk_cache = {}
with transaction.atomic():
syncable_dict = _profile_models[profile]... | [
"Takes",
"data",
"from",
"the",
"store",
"and",
"integrates",
"into",
"the",
"application",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/sync_utils.py#L154-L223 | [
"def",
"_deserialize_from_store",
"(",
"profile",
")",
":",
"# we first serialize to avoid deserialization merge conflicts",
"_serialize_into_store",
"(",
"profile",
")",
"fk_cache",
"=",
"{",
"}",
"with",
"transaction",
".",
"atomic",
"(",
")",
":",
"syncable_dict",
"=... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | _queue_into_buffer | Takes a chunk of data from the store to be put into the buffer to be sent to another morango instance. | morango/utils/sync_utils.py | def _queue_into_buffer(transfersession):
"""
Takes a chunk of data from the store to be put into the buffer to be sent to another morango instance.
"""
last_saved_by_conditions = []
filter_prefixes = Filter(transfersession.filter)
server_fsic = json.loads(transfersession.server_fsic)
client_... | def _queue_into_buffer(transfersession):
"""
Takes a chunk of data from the store to be put into the buffer to be sent to another morango instance.
"""
last_saved_by_conditions = []
filter_prefixes = Filter(transfersession.filter)
server_fsic = json.loads(transfersession.server_fsic)
client_... | [
"Takes",
"a",
"chunk",
"of",
"data",
"from",
"the",
"store",
"to",
"be",
"put",
"into",
"the",
"buffer",
"to",
"be",
"sent",
"to",
"another",
"morango",
"instance",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/sync_utils.py#L227-L286 | [
"def",
"_queue_into_buffer",
"(",
"transfersession",
")",
":",
"last_saved_by_conditions",
"=",
"[",
"]",
"filter_prefixes",
"=",
"Filter",
"(",
"transfersession",
".",
"filter",
")",
"server_fsic",
"=",
"json",
".",
"loads",
"(",
"transfersession",
".",
"server_f... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | _dequeue_into_store | Takes data from the buffers and merges into the store and record max counters. | morango/utils/sync_utils.py | def _dequeue_into_store(transfersession):
"""
Takes data from the buffers and merges into the store and record max counters.
"""
with connection.cursor() as cursor:
DBBackend._dequeuing_delete_rmcb_records(cursor, transfersession.id)
DBBackend._dequeuing_delete_buffered_records(cursor, t... | def _dequeue_into_store(transfersession):
"""
Takes data from the buffers and merges into the store and record max counters.
"""
with connection.cursor() as cursor:
DBBackend._dequeuing_delete_rmcb_records(cursor, transfersession.id)
DBBackend._dequeuing_delete_buffered_records(cursor, t... | [
"Takes",
"data",
"from",
"the",
"buffers",
"and",
"merges",
"into",
"the",
"store",
"and",
"record",
"max",
"counters",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/sync_utils.py#L289-L307 | [
"def",
"_dequeue_into_store",
"(",
"transfersession",
")",
":",
"with",
"connection",
".",
"cursor",
"(",
")",
"as",
"cursor",
":",
"DBBackend",
".",
"_dequeuing_delete_rmcb_records",
"(",
"cursor",
",",
"transfersession",
".",
"id",
")",
"DBBackend",
".",
"_deq... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | max_parameter_substitution | SQLite has a limit on the max number of variables allowed for parameter substitution. This limit is usually 999, but
can be compiled to a different number. This function calculates what the max is for the sqlite version running on the device.
We use the calculated value to chunk our SQL bulk insert statements w... | morango/util.py | def max_parameter_substitution():
"""
SQLite has a limit on the max number of variables allowed for parameter substitution. This limit is usually 999, but
can be compiled to a different number. This function calculates what the max is for the sqlite version running on the device.
We use the calculated v... | def max_parameter_substitution():
"""
SQLite has a limit on the max number of variables allowed for parameter substitution. This limit is usually 999, but
can be compiled to a different number. This function calculates what the max is for the sqlite version running on the device.
We use the calculated v... | [
"SQLite",
"has",
"a",
"limit",
"on",
"the",
"max",
"number",
"of",
"variables",
"allowed",
"for",
"parameter",
"substitution",
".",
"This",
"limit",
"is",
"usually",
"999",
"but",
"can",
"be",
"compiled",
"to",
"a",
"different",
"number",
".",
"This",
"fun... | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/util.py#L67-L94 | [
"def",
"max_parameter_substitution",
"(",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"SQLITE_VARIABLE_FILE_CACHE",
")",
":",
"return",
"conn",
"=",
"sqlite3",
".",
"connect",
"(",
"':memory:'",
")",
"low",
"=",
"1",
"high",
"=",
"1000",
"# hard... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | BasicMultiArgumentAuthentication.authenticate_credentials | Authenticate the userargs and password against Django auth backends.
The "userargs" string may be just the username, or a querystring-encoded set of params. | morango/api/permissions.py | def authenticate_credentials(self, userargs, password, request=None):
"""
Authenticate the userargs and password against Django auth backends.
The "userargs" string may be just the username, or a querystring-encoded set of params.
"""
credentials = {
'password': pass... | def authenticate_credentials(self, userargs, password, request=None):
"""
Authenticate the userargs and password against Django auth backends.
The "userargs" string may be just the username, or a querystring-encoded set of params.
"""
credentials = {
'password': pass... | [
"Authenticate",
"the",
"userargs",
"and",
"password",
"against",
"Django",
"auth",
"backends",
".",
"The",
"userargs",
"string",
"may",
"be",
"just",
"the",
"username",
"or",
"a",
"querystring",
"-",
"encoded",
"set",
"of",
"params",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/api/permissions.py#L15-L43 | [
"def",
"authenticate_credentials",
"(",
"self",
",",
"userargs",
",",
"password",
",",
"request",
"=",
"None",
")",
":",
"credentials",
"=",
"{",
"'password'",
":",
"password",
"}",
"if",
"\"=\"",
"not",
"in",
"userargs",
":",
"# if it doesn't seem to be in quer... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | _multiple_self_ref_fk_check | We check whether a class has more than 1 FK reference to itself. | morango/utils/register_models.py | def _multiple_self_ref_fk_check(class_model):
"""
We check whether a class has more than 1 FK reference to itself.
"""
self_fk = []
for f in class_model._meta.concrete_fields:
if f.related_model in self_fk:
return True
if f.related_model == class_model:
self_f... | def _multiple_self_ref_fk_check(class_model):
"""
We check whether a class has more than 1 FK reference to itself.
"""
self_fk = []
for f in class_model._meta.concrete_fields:
if f.related_model in self_fk:
return True
if f.related_model == class_model:
self_f... | [
"We",
"check",
"whether",
"a",
"class",
"has",
"more",
"than",
"1",
"FK",
"reference",
"to",
"itself",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/register_models.py#L21-L31 | [
"def",
"_multiple_self_ref_fk_check",
"(",
"class_model",
")",
":",
"self_fk",
"=",
"[",
"]",
"for",
"f",
"in",
"class_model",
".",
"_meta",
".",
"concrete_fields",
":",
"if",
"f",
".",
"related_model",
"in",
"self_fk",
":",
"return",
"True",
"if",
"f",
".... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | add_syncable_models | Per profile, adds each model to a dictionary mapping the morango model name to its model class.
We sort by ForeignKey dependencies to safely sync data. | morango/utils/register_models.py | def add_syncable_models():
"""
Per profile, adds each model to a dictionary mapping the morango model name to its model class.
We sort by ForeignKey dependencies to safely sync data.
"""
import django.apps
from morango.models import SyncableModel
from morango.manager import SyncableModelMan... | def add_syncable_models():
"""
Per profile, adds each model to a dictionary mapping the morango model name to its model class.
We sort by ForeignKey dependencies to safely sync data.
"""
import django.apps
from morango.models import SyncableModel
from morango.manager import SyncableModelMan... | [
"Per",
"profile",
"adds",
"each",
"model",
"to",
"a",
"dictionary",
"mapping",
"the",
"morango",
"model",
"name",
"to",
"its",
"model",
"class",
".",
"We",
"sort",
"by",
"ForeignKey",
"dependencies",
"to",
"safely",
"sync",
"data",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/register_models.py#L56-L112 | [
"def",
"add_syncable_models",
"(",
")",
":",
"import",
"django",
".",
"apps",
"from",
"morango",
".",
"models",
"import",
"SyncableModel",
"from",
"morango",
".",
"manager",
"import",
"SyncableModelManager",
"from",
"morango",
".",
"query",
"import",
"SyncableMode... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | SQLWrapper._bulk_insert_into_app_models | Example query:
`REPLACE INTO model (F1,F2,F3) VALUES (%s, %s, %s), (%s, %s, %s), (%s, %s, %s)`
where values=[1,2,3,4,5,6,7,8,9] | morango/utils/backends/sqlite.py | def _bulk_insert_into_app_models(self, cursor, app_model, fields, db_values, placeholder_list):
"""
Example query:
`REPLACE INTO model (F1,F2,F3) VALUES (%s, %s, %s), (%s, %s, %s), (%s, %s, %s)`
where values=[1,2,3,4,5,6,7,8,9]
"""
# calculate and create equal sized chunk... | def _bulk_insert_into_app_models(self, cursor, app_model, fields, db_values, placeholder_list):
"""
Example query:
`REPLACE INTO model (F1,F2,F3) VALUES (%s, %s, %s), (%s, %s, %s), (%s, %s, %s)`
where values=[1,2,3,4,5,6,7,8,9]
"""
# calculate and create equal sized chunk... | [
"Example",
"query",
":",
"REPLACE",
"INTO",
"model",
"(",
"F1",
"F2",
"F3",
")",
"VALUES",
"(",
"%s",
"%s",
"%s",
")",
"(",
"%s",
"%s",
"%s",
")",
"(",
"%s",
"%s",
"%s",
")",
"where",
"values",
"=",
"[",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"... | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/utils/backends/sqlite.py#L18-L37 | [
"def",
"_bulk_insert_into_app_models",
"(",
"self",
",",
"cursor",
",",
"app_model",
",",
"fields",
",",
"db_values",
",",
"placeholder_list",
")",
":",
"# calculate and create equal sized chunks of data to insert incrementally",
"num_of_rows_able_to_insert",
"=",
"self",
"."... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | NetworkSyncConnection._request | Generic request method designed to handle any morango endpoint.
:param endpoint: constant representing which morango endpoint we are querying
:param method: HTTP verb/method for request
:param lookup: the pk value for the specific object we are querying
:param data: dict that will be fo... | morango/syncsession.py | def _request(self, endpoint, method="GET", lookup=None, data={}, params={}, userargs=None, password=None):
"""
Generic request method designed to handle any morango endpoint.
:param endpoint: constant representing which morango endpoint we are querying
:param method: HTTP verb/method fo... | def _request(self, endpoint, method="GET", lookup=None, data={}, params={}, userargs=None, password=None):
"""
Generic request method designed to handle any morango endpoint.
:param endpoint: constant representing which morango endpoint we are querying
:param method: HTTP verb/method fo... | [
"Generic",
"request",
"method",
"designed",
"to",
"handle",
"any",
"morango",
"endpoint",
"."
] | learningequality/morango | python | https://github.com/learningequality/morango/blob/c3ec2554b026f65ac5f0fc5c9d439277fbac14f9/morango/syncsession.py#L76-L100 | [
"def",
"_request",
"(",
"self",
",",
"endpoint",
",",
"method",
"=",
"\"GET\"",
",",
"lookup",
"=",
"None",
",",
"data",
"=",
"{",
"}",
",",
"params",
"=",
"{",
"}",
",",
"userargs",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"# convert u... | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 |
valid | fuzzyfinder | Args:
input (str): A partial string which is typically entered by a user.
collection (iterable): A collection of strings which will be filtered
based on the `input`.
accessor (function): If the `collection` is not an iterable of strings,
... | fuzzyfinder/main.py | def fuzzyfinder(input, collection, accessor=lambda x: x, sort_results=True):
"""
Args:
input (str): A partial string which is typically entered by a user.
collection (iterable): A collection of strings which will be filtered
based on the `input`.
accessor (... | def fuzzyfinder(input, collection, accessor=lambda x: x, sort_results=True):
"""
Args:
input (str): A partial string which is typically entered by a user.
collection (iterable): A collection of strings which will be filtered
based on the `input`.
accessor (... | [
"Args",
":",
"input",
"(",
"str",
")",
":",
"A",
"partial",
"string",
"which",
"is",
"typically",
"entered",
"by",
"a",
"user",
".",
"collection",
"(",
"iterable",
")",
":",
"A",
"collection",
"of",
"strings",
"which",
"will",
"be",
"filtered",
"based",
... | amjith/fuzzyfinder | python | https://github.com/amjith/fuzzyfinder/blob/43fe7676cad68e269bbace7bb2fd9b77f2e07da9/fuzzyfinder/main.py#L6-L41 | [
"def",
"fuzzyfinder",
"(",
"input",
",",
"collection",
",",
"accessor",
"=",
"lambda",
"x",
":",
"x",
",",
"sort_results",
"=",
"True",
")",
":",
"suggestions",
"=",
"[",
"]",
"input",
"=",
"str",
"(",
"input",
")",
"if",
"not",
"isinstance",
"(",
"i... | 43fe7676cad68e269bbace7bb2fd9b77f2e07da9 |
valid | TokenGenerator.create_access_token | Creates an access token.
TODO: check valid in hours
TODO: maybe specify how often a token can be used | twitcher/tokengenerator.py | def create_access_token(self, valid_in_hours=1, data=None):
"""
Creates an access token.
TODO: check valid in hours
TODO: maybe specify how often a token can be used
"""
data = data or {}
token = AccessToken(
token=self.generate(),
expires... | def create_access_token(self, valid_in_hours=1, data=None):
"""
Creates an access token.
TODO: check valid in hours
TODO: maybe specify how often a token can be used
"""
data = data or {}
token = AccessToken(
token=self.generate(),
expires... | [
"Creates",
"an",
"access",
"token",
"."
] | bird-house/twitcher | python | https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/tokengenerator.py#L22-L34 | [
"def",
"create_access_token",
"(",
"self",
",",
"valid_in_hours",
"=",
"1",
",",
"data",
"=",
"None",
")",
":",
"data",
"=",
"data",
"or",
"{",
"}",
"token",
"=",
"AccessToken",
"(",
"token",
"=",
"self",
".",
"generate",
"(",
")",
",",
"expires_at",
... | e6a36b3aeeacf44eec537434b0fb87c09ab54b5f |
valid | MongodbServiceStore.save_service | Stores an OWS service in mongodb. | twitcher/store/mongodb.py | def save_service(self, service, overwrite=True):
"""
Stores an OWS service in mongodb.
"""
name = namesgenerator.get_sane_name(service.name)
if not name:
name = namesgenerator.get_random_name()
if self.collection.count_documents({'name': name}) > 0:
... | def save_service(self, service, overwrite=True):
"""
Stores an OWS service in mongodb.
"""
name = namesgenerator.get_sane_name(service.name)
if not name:
name = namesgenerator.get_random_name()
if self.collection.count_documents({'name': name}) > 0:
... | [
"Stores",
"an",
"OWS",
"service",
"in",
"mongodb",
"."
] | bird-house/twitcher | python | https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/store/mongodb.py#L52-L75 | [
"def",
"save_service",
"(",
"self",
",",
"service",
",",
"overwrite",
"=",
"True",
")",
":",
"name",
"=",
"namesgenerator",
".",
"get_sane_name",
"(",
"service",
".",
"name",
")",
"if",
"not",
"name",
":",
"name",
"=",
"namesgenerator",
".",
"get_random_na... | e6a36b3aeeacf44eec537434b0fb87c09ab54b5f |
valid | MongodbServiceStore.list_services | Lists all services in mongodb storage. | twitcher/store/mongodb.py | def list_services(self):
"""
Lists all services in mongodb storage.
"""
my_services = []
for service in self.collection.find().sort('name', pymongo.ASCENDING):
my_services.append(Service(service))
return my_services | def list_services(self):
"""
Lists all services in mongodb storage.
"""
my_services = []
for service in self.collection.find().sort('name', pymongo.ASCENDING):
my_services.append(Service(service))
return my_services | [
"Lists",
"all",
"services",
"in",
"mongodb",
"storage",
"."
] | bird-house/twitcher | python | https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/store/mongodb.py#L84-L91 | [
"def",
"list_services",
"(",
"self",
")",
":",
"my_services",
"=",
"[",
"]",
"for",
"service",
"in",
"self",
".",
"collection",
".",
"find",
"(",
")",
".",
"sort",
"(",
"'name'",
",",
"pymongo",
".",
"ASCENDING",
")",
":",
"my_services",
".",
"append",... | e6a36b3aeeacf44eec537434b0fb87c09ab54b5f |
valid | MongodbServiceStore.fetch_by_name | Gets service for given ``name`` from mongodb storage. | twitcher/store/mongodb.py | def fetch_by_name(self, name):
"""
Gets service for given ``name`` from mongodb storage.
"""
service = self.collection.find_one({'name': name})
if not service:
raise ServiceNotFound
return Service(service) | def fetch_by_name(self, name):
"""
Gets service for given ``name`` from mongodb storage.
"""
service = self.collection.find_one({'name': name})
if not service:
raise ServiceNotFound
return Service(service) | [
"Gets",
"service",
"for",
"given",
"name",
"from",
"mongodb",
"storage",
"."
] | bird-house/twitcher | python | https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/store/mongodb.py#L93-L100 | [
"def",
"fetch_by_name",
"(",
"self",
",",
"name",
")",
":",
"service",
"=",
"self",
".",
"collection",
".",
"find_one",
"(",
"{",
"'name'",
":",
"name",
"}",
")",
"if",
"not",
"service",
":",
"raise",
"ServiceNotFound",
"return",
"Service",
"(",
"service... | e6a36b3aeeacf44eec537434b0fb87c09ab54b5f |
valid | MongodbServiceStore.fetch_by_url | Gets service for given ``url`` from mongodb storage. | twitcher/store/mongodb.py | def fetch_by_url(self, url):
"""
Gets service for given ``url`` from mongodb storage.
"""
service = self.collection.find_one({'url': url})
if not service:
raise ServiceNotFound
return Service(service) | def fetch_by_url(self, url):
"""
Gets service for given ``url`` from mongodb storage.
"""
service = self.collection.find_one({'url': url})
if not service:
raise ServiceNotFound
return Service(service) | [
"Gets",
"service",
"for",
"given",
"url",
"from",
"mongodb",
"storage",
"."
] | bird-house/twitcher | python | https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/store/mongodb.py#L102-L109 | [
"def",
"fetch_by_url",
"(",
"self",
",",
"url",
")",
":",
"service",
"=",
"self",
".",
"collection",
".",
"find_one",
"(",
"{",
"'url'",
":",
"url",
"}",
")",
"if",
"not",
"service",
":",
"raise",
"ServiceNotFound",
"return",
"Service",
"(",
"service",
... | e6a36b3aeeacf44eec537434b0fb87c09ab54b5f |
valid | owsproxy | TODO: use ows exceptions | twitcher/owsproxy.py | def owsproxy(request):
"""
TODO: use ows exceptions
"""
try:
service_name = request.matchdict.get('service_name')
extra_path = request.matchdict.get('extra_path')
store = servicestore_factory(request.registry)
service = store.fetch_by_name(service_name)
except Excepti... | def owsproxy(request):
"""
TODO: use ows exceptions
"""
try:
service_name = request.matchdict.get('service_name')
extra_path = request.matchdict.get('extra_path')
store = servicestore_factory(request.registry)
service = store.fetch_by_name(service_name)
except Excepti... | [
"TODO",
":",
"use",
"ows",
"exceptions"
] | bird-house/twitcher | python | https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/owsproxy.py#L133-L146 | [
"def",
"owsproxy",
"(",
"request",
")",
":",
"try",
":",
"service_name",
"=",
"request",
".",
"matchdict",
".",
"get",
"(",
"'service_name'",
")",
"extra_path",
"=",
"request",
".",
"matchdict",
".",
"get",
"(",
"'extra_path'",
")",
"store",
"=",
"services... | e6a36b3aeeacf44eec537434b0fb87c09ab54b5f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.