repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
spyder-ide/spyder
spyder/utils/programs.py
is_module_installed
def is_module_installed(module_name, version=None, installed_version=None, interpreter=None): """ Return True if module *module_name* is installed If version is not None, checking module version (module must have an attribute named '__version__') version may starts ...
python
def is_module_installed(module_name, version=None, installed_version=None, interpreter=None): """ Return True if module *module_name* is installed If version is not None, checking module version (module must have an attribute named '__version__') version may starts ...
[ "def", "is_module_installed", "(", "module_name", ",", "version", "=", "None", ",", "installed_version", "=", "None", ",", "interpreter", "=", "None", ")", ":", "if", "interpreter", ":", "if", "osp", ".", "isfile", "(", "interpreter", ")", "and", "(", "'py...
Return True if module *module_name* is installed If version is not None, checking module version (module must have an attribute named '__version__') version may starts with =, >=, > or < to specify the exact requirement ; multiple conditions may be separated by ';' (e.g. '>=0.13;<1.0') in...
[ "Return", "True", "if", "module", "*", "module_name", "*", "is", "installed", "If", "version", "is", "not", "None", "checking", "module", "version", "(", "module", "must", "have", "an", "attribute", "named", "__version__", ")", "version", "may", "starts", "w...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L390-L476
train
spyder-ide/spyder
spyder/utils/programs.py
is_python_interpreter_valid_name
def is_python_interpreter_valid_name(filename): """Check that the python interpreter file has a valid name.""" pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$' if re.match(pattern, filename, flags=re.I) is None: return False else: return True
python
def is_python_interpreter_valid_name(filename): """Check that the python interpreter file has a valid name.""" pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$' if re.match(pattern, filename, flags=re.I) is None: return False else: return True
[ "def", "is_python_interpreter_valid_name", "(", "filename", ")", ":", "pattern", "=", "r'.*python(\\d\\.?\\d*)?(w)?(.exe)?$'", "if", "re", ".", "match", "(", "pattern", ",", "filename", ",", "flags", "=", "re", ".", "I", ")", "is", "None", ":", "return", "Fals...
Check that the python interpreter file has a valid name.
[ "Check", "that", "the", "python", "interpreter", "file", "has", "a", "valid", "name", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L478-L484
train
spyder-ide/spyder
spyder/utils/programs.py
is_python_interpreter
def is_python_interpreter(filename): """Evaluate wether a file is a python interpreter or not.""" real_filename = os.path.realpath(filename) # To follow symlink if existent if (not osp.isfile(real_filename) or not is_python_interpreter_valid_name(filename)): return False elif is_...
python
def is_python_interpreter(filename): """Evaluate wether a file is a python interpreter or not.""" real_filename = os.path.realpath(filename) # To follow symlink if existent if (not osp.isfile(real_filename) or not is_python_interpreter_valid_name(filename)): return False elif is_...
[ "def", "is_python_interpreter", "(", "filename", ")", ":", "real_filename", "=", "os", ".", "path", ".", "realpath", "(", "filename", ")", "# To follow symlink if existent\r", "if", "(", "not", "osp", ".", "isfile", "(", "real_filename", ")", "or", "not", "is_...
Evaluate wether a file is a python interpreter or not.
[ "Evaluate", "wether", "a", "file", "is", "a", "python", "interpreter", "or", "not", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L486-L515
train
spyder-ide/spyder
spyder/utils/programs.py
is_pythonw
def is_pythonw(filename): """Check that the python interpreter has 'pythonw'.""" pattern = r'.*python(\d\.?\d*)?w(.exe)?$' if re.match(pattern, filename, flags=re.I) is None: return False else: return True
python
def is_pythonw(filename): """Check that the python interpreter has 'pythonw'.""" pattern = r'.*python(\d\.?\d*)?w(.exe)?$' if re.match(pattern, filename, flags=re.I) is None: return False else: return True
[ "def", "is_pythonw", "(", "filename", ")", ":", "pattern", "=", "r'.*python(\\d\\.?\\d*)?w(.exe)?$'", "if", "re", ".", "match", "(", "pattern", ",", "filename", ",", "flags", "=", "re", ".", "I", ")", "is", "None", ":", "return", "False", "else", ":", "r...
Check that the python interpreter has 'pythonw'.
[ "Check", "that", "the", "python", "interpreter", "has", "pythonw", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L518-L524
train
spyder-ide/spyder
spyder/utils/programs.py
check_python_help
def check_python_help(filename): """Check that the python interpreter can execute help.""" try: proc = run_program(filename, ["-h"]) output = to_text_string(proc.communicate()[0]) valid = ("Options and arguments (and corresponding environment " "variables)") ...
python
def check_python_help(filename): """Check that the python interpreter can execute help.""" try: proc = run_program(filename, ["-h"]) output = to_text_string(proc.communicate()[0]) valid = ("Options and arguments (and corresponding environment " "variables)") ...
[ "def", "check_python_help", "(", "filename", ")", ":", "try", ":", "proc", "=", "run_program", "(", "filename", ",", "[", "\"-h\"", "]", ")", "output", "=", "to_text_string", "(", "proc", ".", "communicate", "(", ")", "[", "0", "]", ")", "valid", "=", ...
Check that the python interpreter can execute help.
[ "Check", "that", "the", "python", "interpreter", "can", "execute", "help", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L527-L539
train
spyder-ide/spyder
spyder/plugins/editor/panels/debugger.py
DebuggerPanel.sizeHint
def sizeHint(self): """Override Qt method. Returns the widget size hint (based on the editor font size). """ fm = QFontMetrics(self.editor.font()) size_hint = QSize(fm.height(), fm.height()) if size_hint.width() > 16: size_hint.setWidth(16) return siz...
python
def sizeHint(self): """Override Qt method. Returns the widget size hint (based on the editor font size). """ fm = QFontMetrics(self.editor.font()) size_hint = QSize(fm.height(), fm.height()) if size_hint.width() > 16: size_hint.setWidth(16) return siz...
[ "def", "sizeHint", "(", "self", ")", ":", "fm", "=", "QFontMetrics", "(", "self", ".", "editor", ".", "font", "(", ")", ")", "size_hint", "=", "QSize", "(", "fm", ".", "height", "(", ")", ",", "fm", ".", "height", "(", ")", ")", "if", "size_hint"...
Override Qt method. Returns the widget size hint (based on the editor font size).
[ "Override", "Qt", "method", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L40-L49
train
spyder-ide/spyder
spyder/plugins/editor/panels/debugger.py
DebuggerPanel._draw_breakpoint_icon
def _draw_breakpoint_icon(self, top, painter, icon_name): """Draw the given breakpoint pixmap. Args: top (int): top of the line to draw the breakpoint icon. painter (QPainter) icon_name (srt): key of icon to draw (see: self.icons) """ rect = QRect(0, ...
python
def _draw_breakpoint_icon(self, top, painter, icon_name): """Draw the given breakpoint pixmap. Args: top (int): top of the line to draw the breakpoint icon. painter (QPainter) icon_name (srt): key of icon to draw (see: self.icons) """ rect = QRect(0, ...
[ "def", "_draw_breakpoint_icon", "(", "self", ",", "top", ",", "painter", ",", "icon_name", ")", ":", "rect", "=", "QRect", "(", "0", ",", "top", ",", "self", ".", "sizeHint", "(", ")", ".", "width", "(", ")", ",", "self", ".", "sizeHint", "(", ")",...
Draw the given breakpoint pixmap. Args: top (int): top of the line to draw the breakpoint icon. painter (QPainter) icon_name (srt): key of icon to draw (see: self.icons)
[ "Draw", "the", "given", "breakpoint", "pixmap", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L51-L66
train
spyder-ide/spyder
spyder/plugins/editor/panels/debugger.py
DebuggerPanel.paintEvent
def paintEvent(self, event): """Override Qt method. Paint breakpoints icons. """ super(DebuggerPanel, self).paintEvent(event) painter = QPainter(self) painter.fillRect(event.rect(), self.editor.sideareas_color) for top, line_number, block in self.editor.visible_...
python
def paintEvent(self, event): """Override Qt method. Paint breakpoints icons. """ super(DebuggerPanel, self).paintEvent(event) painter = QPainter(self) painter.fillRect(event.rect(), self.editor.sideareas_color) for top, line_number, block in self.editor.visible_...
[ "def", "paintEvent", "(", "self", ",", "event", ")", ":", "super", "(", "DebuggerPanel", ",", "self", ")", ".", "paintEvent", "(", "event", ")", "painter", "=", "QPainter", "(", "self", ")", "painter", ".", "fillRect", "(", "event", ".", "rect", "(", ...
Override Qt method. Paint breakpoints icons.
[ "Override", "Qt", "method", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L80-L102
train
spyder-ide/spyder
spyder/plugins/editor/panels/debugger.py
DebuggerPanel.mousePressEvent
def mousePressEvent(self, event): """Override Qt method Add/remove breakpoints by single click. """ line_number = self.editor.get_linenumber_from_mouse_event(event) shift = event.modifiers() & Qt.ShiftModifier self.editor.debugger.toogle_breakpoint(line_number, ...
python
def mousePressEvent(self, event): """Override Qt method Add/remove breakpoints by single click. """ line_number = self.editor.get_linenumber_from_mouse_event(event) shift = event.modifiers() & Qt.ShiftModifier self.editor.debugger.toogle_breakpoint(line_number, ...
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "line_number", "=", "self", ".", "editor", ".", "get_linenumber_from_mouse_event", "(", "event", ")", "shift", "=", "event", ".", "modifiers", "(", ")", "&", "Qt", ".", "ShiftModifier", "self", ...
Override Qt method Add/remove breakpoints by single click.
[ "Override", "Qt", "method" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L104-L112
train
spyder-ide/spyder
spyder/plugins/editor/panels/debugger.py
DebuggerPanel.mouseMoveEvent
def mouseMoveEvent(self, event): """Override Qt method. Draw semitransparent breakpoint hint. """ self.line_number_hint = self.editor.get_linenumber_from_mouse_event( event) self.update()
python
def mouseMoveEvent(self, event): """Override Qt method. Draw semitransparent breakpoint hint. """ self.line_number_hint = self.editor.get_linenumber_from_mouse_event( event) self.update()
[ "def", "mouseMoveEvent", "(", "self", ",", "event", ")", ":", "self", ".", "line_number_hint", "=", "self", ".", "editor", ".", "get_linenumber_from_mouse_event", "(", "event", ")", "self", ".", "update", "(", ")" ]
Override Qt method. Draw semitransparent breakpoint hint.
[ "Override", "Qt", "method", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L114-L121
train
spyder-ide/spyder
spyder/plugins/editor/panels/debugger.py
DebuggerPanel.on_state_changed
def on_state_changed(self, state): """Change visibility and connect/disconnect signal. Args: state (bool): Activate/deactivate. """ if state: self.editor.sig_breakpoints_changed.connect(self.repaint) self.editor.sig_debug_stop.connect(self.set_current...
python
def on_state_changed(self, state): """Change visibility and connect/disconnect signal. Args: state (bool): Activate/deactivate. """ if state: self.editor.sig_breakpoints_changed.connect(self.repaint) self.editor.sig_debug_stop.connect(self.set_current...
[ "def", "on_state_changed", "(", "self", ",", "state", ")", ":", "if", "state", ":", "self", ".", "editor", ".", "sig_breakpoints_changed", ".", "connect", "(", "self", ".", "repaint", ")", "self", ".", "editor", ".", "sig_debug_stop", ".", "connect", "(", ...
Change visibility and connect/disconnect signal. Args: state (bool): Activate/deactivate.
[ "Change", "visibility", "and", "connect", "/", "disconnect", "signal", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L138-L153
train
spyder-ide/spyder
spyder/utils/workers.py
handle_qbytearray
def handle_qbytearray(obj, encoding): """Qt/Python2/3 compatibility helper.""" if isinstance(obj, QByteArray): obj = obj.data() return to_text_string(obj, encoding=encoding)
python
def handle_qbytearray(obj, encoding): """Qt/Python2/3 compatibility helper.""" if isinstance(obj, QByteArray): obj = obj.data() return to_text_string(obj, encoding=encoding)
[ "def", "handle_qbytearray", "(", "obj", ",", "encoding", ")", ":", "if", "isinstance", "(", "obj", ",", "QByteArray", ")", ":", "obj", "=", "obj", ".", "data", "(", ")", "return", "to_text_string", "(", "obj", ",", "encoding", "=", "encoding", ")" ]
Qt/Python2/3 compatibility helper.
[ "Qt", "/", "Python2", "/", "3", "compatibility", "helper", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L29-L34
train
spyder-ide/spyder
spyder/utils/workers.py
sleeping_func
def sleeping_func(arg, secs=10, result_queue=None): """This methods illustrates how the workers can be used.""" import time time.sleep(secs) if result_queue is not None: result_queue.put(arg) else: return arg
python
def sleeping_func(arg, secs=10, result_queue=None): """This methods illustrates how the workers can be used.""" import time time.sleep(secs) if result_queue is not None: result_queue.put(arg) else: return arg
[ "def", "sleeping_func", "(", "arg", ",", "secs", "=", "10", ",", "result_queue", "=", "None", ")", ":", "import", "time", "time", ".", "sleep", "(", "secs", ")", "if", "result_queue", "is", "not", "None", ":", "result_queue", ".", "put", "(", "arg", ...
This methods illustrates how the workers can be used.
[ "This", "methods", "illustrates", "how", "the", "workers", "can", "be", "used", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L328-L335
train
spyder-ide/spyder
spyder/utils/workers.py
PythonWorker.start
def start(self): """Start the worker (emits sig_started signal with worker as arg).""" if not self._started: self.sig_started.emit(self) self._started = True
python
def start(self): """Start the worker (emits sig_started signal with worker as arg).""" if not self._started: self.sig_started.emit(self) self._started = True
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "_started", ":", "self", ".", "sig_started", ".", "emit", "(", "self", ")", "self", ".", "_started", "=", "True" ]
Start the worker (emits sig_started signal with worker as arg).
[ "Start", "the", "worker", "(", "emits", "sig_started", "signal", "with", "worker", "as", "arg", ")", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L59-L63
train
spyder-ide/spyder
spyder/utils/workers.py
PythonWorker._start
def _start(self): """Start process worker for given method args and kwargs.""" error = None output = None try: output = self.func(*self.args, **self.kwargs) except Exception as err: error = err if not self._is_finished: self.sig_finis...
python
def _start(self): """Start process worker for given method args and kwargs.""" error = None output = None try: output = self.func(*self.args, **self.kwargs) except Exception as err: error = err if not self._is_finished: self.sig_finis...
[ "def", "_start", "(", "self", ")", ":", "error", "=", "None", "output", "=", "None", "try", ":", "output", "=", "self", ".", "func", "(", "*", "self", ".", "args", ",", "*", "*", "self", ".", "kwargs", ")", "except", "Exception", "as", "err", ":"...
Start process worker for given method args and kwargs.
[ "Start", "process", "worker", "for", "given", "method", "args", "and", "kwargs", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L69-L81
train
spyder-ide/spyder
spyder/utils/workers.py
ProcessWorker._get_encoding
def _get_encoding(self): """Return the encoding/codepage to use.""" enco = 'utf-8' # Currently only cp1252 is allowed? if WIN: import ctypes codepage = to_text_string(ctypes.cdll.kernel32.GetACP()) # import locale # locale.getpreferredenc...
python
def _get_encoding(self): """Return the encoding/codepage to use.""" enco = 'utf-8' # Currently only cp1252 is allowed? if WIN: import ctypes codepage = to_text_string(ctypes.cdll.kernel32.GetACP()) # import locale # locale.getpreferredenc...
[ "def", "_get_encoding", "(", "self", ")", ":", "enco", "=", "'utf-8'", "# Currently only cp1252 is allowed?", "if", "WIN", ":", "import", "ctypes", "codepage", "=", "to_text_string", "(", "ctypes", ".", "cdll", ".", "kernel32", ".", "GetACP", "(", ")", ")", ...
Return the encoding/codepage to use.
[ "Return", "the", "encoding", "/", "codepage", "to", "use", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L118-L129
train
spyder-ide/spyder
spyder/utils/workers.py
ProcessWorker._set_environment
def _set_environment(self, environ): """Set the environment on the QProcess.""" if environ: q_environ = self._process.processEnvironment() for k, v in environ.items(): q_environ.insert(k, v) self._process.setProcessEnvironment(q_environ)
python
def _set_environment(self, environ): """Set the environment on the QProcess.""" if environ: q_environ = self._process.processEnvironment() for k, v in environ.items(): q_environ.insert(k, v) self._process.setProcessEnvironment(q_environ)
[ "def", "_set_environment", "(", "self", ",", "environ", ")", ":", "if", "environ", ":", "q_environ", "=", "self", ".", "_process", ".", "processEnvironment", "(", ")", "for", "k", ",", "v", "in", "environ", ".", "items", "(", ")", ":", "q_environ", "."...
Set the environment on the QProcess.
[ "Set", "the", "environment", "on", "the", "QProcess", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L131-L137
train
spyder-ide/spyder
spyder/utils/workers.py
ProcessWorker._partial
def _partial(self): """Callback for partial output.""" raw_stdout = self._process.readAllStandardOutput() stdout = handle_qbytearray(raw_stdout, self._get_encoding()) if self._partial_stdout is None: self._partial_stdout = stdout else: self._partial_stdou...
python
def _partial(self): """Callback for partial output.""" raw_stdout = self._process.readAllStandardOutput() stdout = handle_qbytearray(raw_stdout, self._get_encoding()) if self._partial_stdout is None: self._partial_stdout = stdout else: self._partial_stdou...
[ "def", "_partial", "(", "self", ")", ":", "raw_stdout", "=", "self", ".", "_process", ".", "readAllStandardOutput", "(", ")", "stdout", "=", "handle_qbytearray", "(", "raw_stdout", ",", "self", ".", "_get_encoding", "(", ")", ")", "if", "self", ".", "_part...
Callback for partial output.
[ "Callback", "for", "partial", "output", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L139-L149
train
spyder-ide/spyder
spyder/utils/workers.py
ProcessWorker._communicate
def _communicate(self): """Callback for communicate.""" if (not self._communicate_first and self._process.state() == QProcess.NotRunning): self.communicate() elif self._fired: self._timer.stop()
python
def _communicate(self): """Callback for communicate.""" if (not self._communicate_first and self._process.state() == QProcess.NotRunning): self.communicate() elif self._fired: self._timer.stop()
[ "def", "_communicate", "(", "self", ")", ":", "if", "(", "not", "self", ".", "_communicate_first", "and", "self", ".", "_process", ".", "state", "(", ")", "==", "QProcess", ".", "NotRunning", ")", ":", "self", ".", "communicate", "(", ")", "elif", "sel...
Callback for communicate.
[ "Callback", "for", "communicate", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L151-L157
train
spyder-ide/spyder
spyder/utils/workers.py
ProcessWorker.communicate
def communicate(self): """Retrieve information.""" self._communicate_first = True self._process.waitForFinished() enco = self._get_encoding() if self._partial_stdout is None: raw_stdout = self._process.readAllStandardOutput() stdout = handle_qbytearray(ra...
python
def communicate(self): """Retrieve information.""" self._communicate_first = True self._process.waitForFinished() enco = self._get_encoding() if self._partial_stdout is None: raw_stdout = self._process.readAllStandardOutput() stdout = handle_qbytearray(ra...
[ "def", "communicate", "(", "self", ")", ":", "self", ".", "_communicate_first", "=", "True", "self", ".", "_process", ".", "waitForFinished", "(", ")", "enco", "=", "self", ".", "_get_encoding", "(", ")", "if", "self", ".", "_partial_stdout", "is", "None",...
Retrieve information.
[ "Retrieve", "information", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L159-L186
train
spyder-ide/spyder
spyder/utils/workers.py
ProcessWorker._start
def _start(self): """Start process.""" if not self._fired: self._partial_ouput = None self._process.start(self._cmd_list[0], self._cmd_list[1:]) self._timer.start()
python
def _start(self): """Start process.""" if not self._fired: self._partial_ouput = None self._process.start(self._cmd_list[0], self._cmd_list[1:]) self._timer.start()
[ "def", "_start", "(", "self", ")", ":", "if", "not", "self", ".", "_fired", ":", "self", ".", "_partial_ouput", "=", "None", "self", ".", "_process", ".", "start", "(", "self", ".", "_cmd_list", "[", "0", "]", ",", "self", ".", "_cmd_list", "[", "1...
Start process.
[ "Start", "process", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L196-L201
train
spyder-ide/spyder
spyder/utils/workers.py
ProcessWorker.terminate
def terminate(self): """Terminate running processes.""" if self._process.state() == QProcess.Running: try: self._process.terminate() except Exception: pass self._fired = True
python
def terminate(self): """Terminate running processes.""" if self._process.state() == QProcess.Running: try: self._process.terminate() except Exception: pass self._fired = True
[ "def", "terminate", "(", "self", ")", ":", "if", "self", ".", "_process", ".", "state", "(", ")", "==", "QProcess", ".", "Running", ":", "try", ":", "self", ".", "_process", ".", "terminate", "(", ")", "except", "Exception", ":", "pass", "self", ".",...
Terminate running processes.
[ "Terminate", "running", "processes", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L203-L210
train
spyder-ide/spyder
spyder/utils/workers.py
WorkerManager._clean_workers
def _clean_workers(self): """Delete periodically workers in workers bag.""" while self._bag_collector: self._bag_collector.popleft() self._timer_worker_delete.stop()
python
def _clean_workers(self): """Delete periodically workers in workers bag.""" while self._bag_collector: self._bag_collector.popleft() self._timer_worker_delete.stop()
[ "def", "_clean_workers", "(", "self", ")", ":", "while", "self", ".", "_bag_collector", ":", "self", ".", "_bag_collector", ".", "popleft", "(", ")", "self", ".", "_timer_worker_delete", ".", "stop", "(", ")" ]
Delete periodically workers in workers bag.
[ "Delete", "periodically", "workers", "in", "workers", "bag", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L243-L247
train
spyder-ide/spyder
spyder/utils/workers.py
WorkerManager._start
def _start(self, worker=None): """Start threads and check for inactive workers.""" if worker: self._queue_workers.append(worker) if self._queue_workers and self._running_threads < self._max_threads: #print('Queue: {0} Running: {1} Workers: {2} ' # 'Thre...
python
def _start(self, worker=None): """Start threads and check for inactive workers.""" if worker: self._queue_workers.append(worker) if self._queue_workers and self._running_threads < self._max_threads: #print('Queue: {0} Running: {1} Workers: {2} ' # 'Thre...
[ "def", "_start", "(", "self", ",", "worker", "=", "None", ")", ":", "if", "worker", ":", "self", ".", "_queue_workers", ".", "append", "(", "worker", ")", "if", "self", ".", "_queue_workers", "and", "self", ".", "_running_threads", "<", "self", ".", "_...
Start threads and check for inactive workers.
[ "Start", "threads", "and", "check", "for", "inactive", "workers", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L249-L289
train
spyder-ide/spyder
spyder/utils/workers.py
WorkerManager.create_python_worker
def create_python_worker(self, func, *args, **kwargs): """Create a new python worker instance.""" worker = PythonWorker(func, args, kwargs) self._create_worker(worker) return worker
python
def create_python_worker(self, func, *args, **kwargs): """Create a new python worker instance.""" worker = PythonWorker(func, args, kwargs) self._create_worker(worker) return worker
[ "def", "create_python_worker", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "worker", "=", "PythonWorker", "(", "func", ",", "args", ",", "kwargs", ")", "self", ".", "_create_worker", "(", "worker", ")", "return", "wor...
Create a new python worker instance.
[ "Create", "a", "new", "python", "worker", "instance", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L291-L295
train
spyder-ide/spyder
spyder/utils/workers.py
WorkerManager.create_process_worker
def create_process_worker(self, cmd_list, environ=None): """Create a new process worker instance.""" worker = ProcessWorker(cmd_list, environ=environ) self._create_worker(worker) return worker
python
def create_process_worker(self, cmd_list, environ=None): """Create a new process worker instance.""" worker = ProcessWorker(cmd_list, environ=environ) self._create_worker(worker) return worker
[ "def", "create_process_worker", "(", "self", ",", "cmd_list", ",", "environ", "=", "None", ")", ":", "worker", "=", "ProcessWorker", "(", "cmd_list", ",", "environ", "=", "environ", ")", "self", ".", "_create_worker", "(", "worker", ")", "return", "worker" ]
Create a new process worker instance.
[ "Create", "a", "new", "process", "worker", "instance", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L297-L301
train
spyder-ide/spyder
spyder/utils/workers.py
WorkerManager.terminate_all
def terminate_all(self): """Terminate all worker processes.""" for worker in self._workers: worker.terminate() # for thread in self._threads: # try: # thread.terminate() # thread.wait() # except Exception: # pas...
python
def terminate_all(self): """Terminate all worker processes.""" for worker in self._workers: worker.terminate() # for thread in self._threads: # try: # thread.terminate() # thread.wait() # except Exception: # pas...
[ "def", "terminate_all", "(", "self", ")", ":", "for", "worker", "in", "self", ".", "_workers", ":", "worker", ".", "terminate", "(", ")", "# for thread in self._threads:", "# try:", "# thread.terminate()", "# thread.wait()", "# except Exception:", ...
Terminate all worker processes.
[ "Terminate", "all", "worker", "processes", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L303-L314
train
spyder-ide/spyder
spyder/utils/workers.py
WorkerManager._create_worker
def _create_worker(self, worker): """Common worker setup.""" worker.sig_started.connect(self._start) self._workers.append(worker)
python
def _create_worker(self, worker): """Common worker setup.""" worker.sig_started.connect(self._start) self._workers.append(worker)
[ "def", "_create_worker", "(", "self", ",", "worker", ")", ":", "worker", ".", "sig_started", ".", "connect", "(", "self", ".", "_start", ")", "self", ".", "_workers", ".", "append", "(", "worker", ")" ]
Common worker setup.
[ "Common", "worker", "setup", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L316-L319
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
gather_file_data
def gather_file_data(name): """ Gather data about a given file. Returns a dict with fields name, mtime and size, containing the relevant data for the fiel. """ res = {'name': name} try: res['mtime'] = osp.getmtime(name) res['size'] = osp.getsize(name) except OSError: ...
python
def gather_file_data(name): """ Gather data about a given file. Returns a dict with fields name, mtime and size, containing the relevant data for the fiel. """ res = {'name': name} try: res['mtime'] = osp.getmtime(name) res['size'] = osp.getsize(name) except OSError: ...
[ "def", "gather_file_data", "(", "name", ")", ":", "res", "=", "{", "'name'", ":", "name", "}", "try", ":", "res", "[", "'mtime'", "]", "=", "osp", ".", "getmtime", "(", "name", ")", "res", "[", "'size'", "]", "=", "osp", ".", "getsize", "(", "nam...
Gather data about a given file. Returns a dict with fields name, mtime and size, containing the relevant data for the fiel.
[ "Gather", "data", "about", "a", "given", "file", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L26-L39
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
file_data_to_str
def file_data_to_str(data): """ Convert file data to a string for display. This function takes the file data produced by gather_file_data(). """ if not data: return _('<i>File name not recorded</i>') res = data['name'] try: mtime_as_str = time.strftime('%Y-%m-%d %H:%M:%S', ...
python
def file_data_to_str(data): """ Convert file data to a string for display. This function takes the file data produced by gather_file_data(). """ if not data: return _('<i>File name not recorded</i>') res = data['name'] try: mtime_as_str = time.strftime('%Y-%m-%d %H:%M:%S', ...
[ "def", "file_data_to_str", "(", "data", ")", ":", "if", "not", "data", ":", "return", "_", "(", "'<i>File name not recorded</i>'", ")", "res", "=", "data", "[", "'name'", "]", "try", ":", "mtime_as_str", "=", "time", ".", "strftime", "(", "'%Y-%m-%d %H:%M:%S...
Convert file data to a string for display. This function takes the file data produced by gather_file_data().
[ "Convert", "file", "data", "to", "a", "string", "for", "display", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L42-L59
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
make_temporary_files
def make_temporary_files(tempdir): """ Make temporary files to simulate a recovery use case. Create a directory under tempdir containing some original files and another directory with autosave files. Return a tuple with the name of the directory with the original files, the name of the directory wi...
python
def make_temporary_files(tempdir): """ Make temporary files to simulate a recovery use case. Create a directory under tempdir containing some original files and another directory with autosave files. Return a tuple with the name of the directory with the original files, the name of the directory wi...
[ "def", "make_temporary_files", "(", "tempdir", ")", ":", "orig_dir", "=", "osp", ".", "join", "(", "tempdir", ",", "'orig'", ")", "os", ".", "mkdir", "(", "orig_dir", ")", "autosave_dir", "=", "osp", ".", "join", "(", "tempdir", ",", "'autosave'", ")", ...
Make temporary files to simulate a recovery use case. Create a directory under tempdir containing some original files and another directory with autosave files. Return a tuple with the name of the directory with the original files, the name of the directory with the autosave files, and the autosave map...
[ "Make", "temporary", "files", "to", "simulate", "a", "recovery", "use", "case", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L278-L321
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
RecoveryDialog.gather_data
def gather_data(self): """ Gather data about files which may be recovered. The data is stored in self.data as a list of tuples with the data pertaining to the original file and the autosave file. Each element of the tuple is a dict as returned by gather_file_data(). """ ...
python
def gather_data(self): """ Gather data about files which may be recovered. The data is stored in self.data as a list of tuples with the data pertaining to the original file and the autosave file. Each element of the tuple is a dict as returned by gather_file_data(). """ ...
[ "def", "gather_data", "(", "self", ")", ":", "self", ".", "data", "=", "[", "]", "try", ":", "FileNotFoundError", "except", "NameError", ":", "# Python 2", "FileNotFoundError", "=", "OSError", "# In Python 3, easier to use os.scandir()", "try", ":", "for", "name",...
Gather data about files which may be recovered. The data is stored in self.data as a list of tuples with the data pertaining to the original file and the autosave file. Each element of the tuple is a dict as returned by gather_file_data().
[ "Gather", "data", "about", "files", "which", "may", "be", "recovered", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L93-L123
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
RecoveryDialog.add_label
def add_label(self): """Add label with explanation at top of dialog window.""" txt = _('Autosave files found. What would you like to do?\n\n' 'This dialog will be shown again on next startup if any ' 'autosave files are not restored, moved or deleted.') label = QL...
python
def add_label(self): """Add label with explanation at top of dialog window.""" txt = _('Autosave files found. What would you like to do?\n\n' 'This dialog will be shown again on next startup if any ' 'autosave files are not restored, moved or deleted.') label = QL...
[ "def", "add_label", "(", "self", ")", ":", "txt", "=", "_", "(", "'Autosave files found. What would you like to do?\\n\\n'", "'This dialog will be shown again on next startup if any '", "'autosave files are not restored, moved or deleted.'", ")", "label", "=", "QLabel", "(", "txt...
Add label with explanation at top of dialog window.
[ "Add", "label", "with", "explanation", "at", "top", "of", "dialog", "window", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L125-L132
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
RecoveryDialog.add_label_to_table
def add_label_to_table(self, row, col, txt): """Add a label to specified cell in table.""" label = QLabel(txt) label.setMargin(5) label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.table.setCellWidget(row, col, label)
python
def add_label_to_table(self, row, col, txt): """Add a label to specified cell in table.""" label = QLabel(txt) label.setMargin(5) label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.table.setCellWidget(row, col, label)
[ "def", "add_label_to_table", "(", "self", ",", "row", ",", "col", ",", "txt", ")", ":", "label", "=", "QLabel", "(", "txt", ")", "label", ".", "setMargin", "(", "5", ")", "label", ".", "setAlignment", "(", "Qt", ".", "AlignLeft", "|", "Qt", ".", "A...
Add a label to specified cell in table.
[ "Add", "a", "label", "to", "specified", "cell", "in", "table", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L134-L139
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
RecoveryDialog.add_table
def add_table(self): """Add table with info about files to be recovered.""" table = QTableWidget(len(self.data), 3, self) self.table = table labels = [_('Original file'), _('Autosave file'), _('Actions')] table.setHorizontalHeaderLabels(labels) table.verticalHeader().hid...
python
def add_table(self): """Add table with info about files to be recovered.""" table = QTableWidget(len(self.data), 3, self) self.table = table labels = [_('Original file'), _('Autosave file'), _('Actions')] table.setHorizontalHeaderLabels(labels) table.verticalHeader().hid...
[ "def", "add_table", "(", "self", ")", ":", "table", "=", "QTableWidget", "(", "len", "(", "self", ".", "data", ")", ",", "3", ",", "self", ")", "self", ".", "table", "=", "table", "labels", "=", "[", "_", "(", "'Original file'", ")", ",", "_", "(...
Add table with info about files to be recovered.
[ "Add", "table", "with", "info", "about", "files", "to", "be", "recovered", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L141-L201
train
spyder-ide/spyder
spyder/plugins/editor/widgets/recover.py
RecoveryDialog.add_cancel_button
def add_cancel_button(self): """Add a cancel button at the bottom of the dialog window.""" button_box = QDialogButtonBox(QDialogButtonBox.Cancel, self) button_box.rejected.connect(self.reject) self.layout.addWidget(button_box)
python
def add_cancel_button(self): """Add a cancel button at the bottom of the dialog window.""" button_box = QDialogButtonBox(QDialogButtonBox.Cancel, self) button_box.rejected.connect(self.reject) self.layout.addWidget(button_box)
[ "def", "add_cancel_button", "(", "self", ")", ":", "button_box", "=", "QDialogButtonBox", "(", "QDialogButtonBox", ".", "Cancel", ",", "self", ")", "button_box", ".", "rejected", ".", "connect", "(", "self", ".", "reject", ")", "self", ".", "layout", ".", ...
Add a cancel button at the bottom of the dialog window.
[ "Add", "a", "cancel", "button", "at", "the", "bottom", "of", "the", "dialog", "window", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L203-L207
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
WorkingDirectory.register_plugin
def register_plugin(self): """Register plugin in Spyder's main window""" self.redirect_stdio.connect(self.main.redirect_internalshell_stdio) self.main.console.shell.refresh.connect(self.refresh_plugin) iconsize = 24 self.toolbar.setIconSize(QSize(iconsize, iconsize)) ...
python
def register_plugin(self): """Register plugin in Spyder's main window""" self.redirect_stdio.connect(self.main.redirect_internalshell_stdio) self.main.console.shell.refresh.connect(self.refresh_plugin) iconsize = 24 self.toolbar.setIconSize(QSize(iconsize, iconsize)) ...
[ "def", "register_plugin", "(", "self", ")", ":", "self", ".", "redirect_stdio", ".", "connect", "(", "self", ".", "main", ".", "redirect_internalshell_stdio", ")", "self", ".", "main", ".", "console", ".", "shell", ".", "refresh", ".", "connect", "(", "sel...
Register plugin in Spyder's main window
[ "Register", "plugin", "in", "Spyder", "s", "main", "window" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L133-L139
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
WorkingDirectory.refresh_plugin
def refresh_plugin(self): """Refresh widget""" curdir = getcwd_or_home() self.pathedit.add_text(curdir) self.save_wdhistory() self.set_previous_enabled.emit( self.histindex is not None and self.histindex > 0) self.set_next_enabled.emit(...
python
def refresh_plugin(self): """Refresh widget""" curdir = getcwd_or_home() self.pathedit.add_text(curdir) self.save_wdhistory() self.set_previous_enabled.emit( self.histindex is not None and self.histindex > 0) self.set_next_enabled.emit(...
[ "def", "refresh_plugin", "(", "self", ")", ":", "curdir", "=", "getcwd_or_home", "(", ")", "self", ".", "pathedit", ".", "add_text", "(", "curdir", ")", "self", ".", "save_wdhistory", "(", ")", "self", ".", "set_previous_enabled", ".", "emit", "(", "self",...
Refresh widget
[ "Refresh", "widget" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L141-L149
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
WorkingDirectory.load_wdhistory
def load_wdhistory(self, workdir=None): """Load history from a text file in user home directory""" if osp.isfile(self.LOG_PATH): wdhistory, _ = encoding.readlines(self.LOG_PATH) wdhistory = [name for name in wdhistory if os.path.isdir(name)] else: if wor...
python
def load_wdhistory(self, workdir=None): """Load history from a text file in user home directory""" if osp.isfile(self.LOG_PATH): wdhistory, _ = encoding.readlines(self.LOG_PATH) wdhistory = [name for name in wdhistory if os.path.isdir(name)] else: if wor...
[ "def", "load_wdhistory", "(", "self", ",", "workdir", "=", "None", ")", ":", "if", "osp", ".", "isfile", "(", "self", ".", "LOG_PATH", ")", ":", "wdhistory", ",", "_", "=", "encoding", ".", "readlines", "(", "self", ".", "LOG_PATH", ")", "wdhistory", ...
Load history from a text file in user home directory
[ "Load", "history", "from", "a", "text", "file", "in", "user", "home", "directory" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L160-L169
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
WorkingDirectory.save_wdhistory
def save_wdhistory(self): """Save history to a text file in user home directory""" text = [ to_text_string( self.pathedit.itemText(index) ) \ for index in range(self.pathedit.count()) ] try: encoding.writelines(text, self.LOG_PATH) except EnvironmentErr...
python
def save_wdhistory(self): """Save history to a text file in user home directory""" text = [ to_text_string( self.pathedit.itemText(index) ) \ for index in range(self.pathedit.count()) ] try: encoding.writelines(text, self.LOG_PATH) except EnvironmentErr...
[ "def", "save_wdhistory", "(", "self", ")", ":", "text", "=", "[", "to_text_string", "(", "self", ".", "pathedit", ".", "itemText", "(", "index", ")", ")", "for", "index", "in", "range", "(", "self", ".", "pathedit", ".", "count", "(", ")", ")", "]", ...
Save history to a text file in user home directory
[ "Save", "history", "to", "a", "text", "file", "in", "user", "home", "directory" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L171-L178
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
WorkingDirectory.select_directory
def select_directory(self): """Select directory""" self.redirect_stdio.emit(False) directory = getexistingdirectory(self.main, _("Select directory"), getcwd_or_home()) if directory: self.chdir(directory) self.redirect_st...
python
def select_directory(self): """Select directory""" self.redirect_stdio.emit(False) directory = getexistingdirectory(self.main, _("Select directory"), getcwd_or_home()) if directory: self.chdir(directory) self.redirect_st...
[ "def", "select_directory", "(", "self", ")", ":", "self", ".", "redirect_stdio", ".", "emit", "(", "False", ")", "directory", "=", "getexistingdirectory", "(", "self", ".", "main", ",", "_", "(", "\"Select directory\"", ")", ",", "getcwd_or_home", "(", ")", ...
Select directory
[ "Select", "directory" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L181-L188
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
WorkingDirectory.parent_directory
def parent_directory(self): """Change working directory to parent directory""" self.chdir(os.path.join(getcwd_or_home(), os.path.pardir))
python
def parent_directory(self): """Change working directory to parent directory""" self.chdir(os.path.join(getcwd_or_home(), os.path.pardir))
[ "def", "parent_directory", "(", "self", ")", ":", "self", ".", "chdir", "(", "os", ".", "path", ".", "join", "(", "getcwd_or_home", "(", ")", ",", "os", ".", "path", ".", "pardir", ")", ")" ]
Change working directory to parent directory
[ "Change", "working", "directory", "to", "parent", "directory" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L203-L205
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
WorkingDirectory.chdir
def chdir(self, directory, browsing_history=False, refresh_explorer=True, refresh_console=True): """Set directory as working directory""" if directory: directory = osp.abspath(to_text_string(directory)) # Working directory history management if browsing_...
python
def chdir(self, directory, browsing_history=False, refresh_explorer=True, refresh_console=True): """Set directory as working directory""" if directory: directory = osp.abspath(to_text_string(directory)) # Working directory history management if browsing_...
[ "def", "chdir", "(", "self", ",", "directory", ",", "browsing_history", "=", "False", ",", "refresh_explorer", "=", "True", ",", "refresh_console", "=", "True", ")", ":", "if", "directory", ":", "directory", "=", "osp", ".", "abspath", "(", "to_text_string",...
Set directory as working directory
[ "Set", "directory", "as", "working", "directory" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L211-L240
train
spyder-ide/spyder
spyder/plugins/editor/utils/debugger.py
DebuggerManager.toogle_breakpoint
def toogle_breakpoint(self, line_number=None, condition=None, edit_condition=False): """Add/remove breakpoint.""" if not self.editor.is_python_like(): return if line_number is None: block = self.editor.textCursor().block() else: ...
python
def toogle_breakpoint(self, line_number=None, condition=None, edit_condition=False): """Add/remove breakpoint.""" if not self.editor.is_python_like(): return if line_number is None: block = self.editor.textCursor().block() else: ...
[ "def", "toogle_breakpoint", "(", "self", ",", "line_number", "=", "None", ",", "condition", "=", "None", ",", "edit_condition", "=", "False", ")", ":", "if", "not", "self", ".", "editor", ".", "is_python_like", "(", ")", ":", "return", "if", "line_number",...
Add/remove breakpoint.
[ "Add", "/", "remove", "breakpoint", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L79-L114
train
spyder-ide/spyder
spyder/plugins/editor/utils/debugger.py
DebuggerManager.get_breakpoints
def get_breakpoints(self): """Get breakpoints""" breakpoints = [] block = self.editor.document().firstBlock() for line_number in range(1, self.editor.document().blockCount()+1): data = block.userData() if data and data.breakpoint: breakpoints.appen...
python
def get_breakpoints(self): """Get breakpoints""" breakpoints = [] block = self.editor.document().firstBlock() for line_number in range(1, self.editor.document().blockCount()+1): data = block.userData() if data and data.breakpoint: breakpoints.appen...
[ "def", "get_breakpoints", "(", "self", ")", ":", "breakpoints", "=", "[", "]", "block", "=", "self", ".", "editor", ".", "document", "(", ")", ".", "firstBlock", "(", ")", "for", "line_number", "in", "range", "(", "1", ",", "self", ".", "editor", "."...
Get breakpoints
[ "Get", "breakpoints" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L116-L125
train
spyder-ide/spyder
spyder/plugins/editor/utils/debugger.py
DebuggerManager.clear_breakpoints
def clear_breakpoints(self): """Clear breakpoints""" self.breakpoints = [] for data in self.editor.blockuserdata_list[:]: data.breakpoint = False # data.breakpoint_condition = None # not necessary, but logical if data.is_empty(): # This is not...
python
def clear_breakpoints(self): """Clear breakpoints""" self.breakpoints = [] for data in self.editor.blockuserdata_list[:]: data.breakpoint = False # data.breakpoint_condition = None # not necessary, but logical if data.is_empty(): # This is not...
[ "def", "clear_breakpoints", "(", "self", ")", ":", "self", ".", "breakpoints", "=", "[", "]", "for", "data", "in", "self", ".", "editor", ".", "blockuserdata_list", "[", ":", "]", ":", "data", ".", "breakpoint", "=", "False", "# data.breakpoint_condition = N...
Clear breakpoints
[ "Clear", "breakpoints" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L127-L137
train
spyder-ide/spyder
spyder/plugins/editor/utils/debugger.py
DebuggerManager.set_breakpoints
def set_breakpoints(self, breakpoints): """Set breakpoints""" self.clear_breakpoints() for line_number, condition in breakpoints: self.toogle_breakpoint(line_number, condition) self.breakpoints = self.get_breakpoints()
python
def set_breakpoints(self, breakpoints): """Set breakpoints""" self.clear_breakpoints() for line_number, condition in breakpoints: self.toogle_breakpoint(line_number, condition) self.breakpoints = self.get_breakpoints()
[ "def", "set_breakpoints", "(", "self", ",", "breakpoints", ")", ":", "self", ".", "clear_breakpoints", "(", ")", "for", "line_number", ",", "condition", "in", "breakpoints", ":", "self", ".", "toogle_breakpoint", "(", "line_number", ",", "condition", ")", "sel...
Set breakpoints
[ "Set", "breakpoints" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L139-L144
train
spyder-ide/spyder
spyder/plugins/editor/utils/debugger.py
DebuggerManager.breakpoints_changed
def breakpoints_changed(self): """Breakpoint list has changed""" breakpoints = self.get_breakpoints() if self.breakpoints != breakpoints: self.breakpoints = breakpoints self.save_breakpoints()
python
def breakpoints_changed(self): """Breakpoint list has changed""" breakpoints = self.get_breakpoints() if self.breakpoints != breakpoints: self.breakpoints = breakpoints self.save_breakpoints()
[ "def", "breakpoints_changed", "(", "self", ")", ":", "breakpoints", "=", "self", ".", "get_breakpoints", "(", ")", "if", "self", ".", "breakpoints", "!=", "breakpoints", ":", "self", ".", "breakpoints", "=", "breakpoints", "self", ".", "save_breakpoints", "(",...
Breakpoint list has changed
[ "Breakpoint", "list", "has", "changed" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L150-L155
train
spyder-ide/spyder
spyder/plugins/editor/extensions/closequotes.py
unmatched_quotes_in_line
def unmatched_quotes_in_line(text): """Return whether a string has open quotes. This simply counts whether the number of quote characters of either type in the string is odd. Take from the IPython project (in IPython/core/completer.py in v0.13) Spyder team: Add some changes to deal with escaped qu...
python
def unmatched_quotes_in_line(text): """Return whether a string has open quotes. This simply counts whether the number of quote characters of either type in the string is odd. Take from the IPython project (in IPython/core/completer.py in v0.13) Spyder team: Add some changes to deal with escaped qu...
[ "def", "unmatched_quotes_in_line", "(", "text", ")", ":", "# We check \" first, then ', so complex cases with nested quotes will", "# get the \" to take precedence.", "text", "=", "text", ".", "replace", "(", "\"\\\\'\"", ",", "\"\"", ")", "text", "=", "text", ".", "repla...
Return whether a string has open quotes. This simply counts whether the number of quote characters of either type in the string is odd. Take from the IPython project (in IPython/core/completer.py in v0.13) Spyder team: Add some changes to deal with escaped quotes - Copyright (C) 2008-2011 IPython...
[ "Return", "whether", "a", "string", "has", "open", "quotes", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L14-L38
train
spyder-ide/spyder
spyder/plugins/editor/extensions/closequotes.py
CloseQuotesExtension.on_state_changed
def on_state_changed(self, state): """Connect/disconnect sig_key_pressed signal.""" if state: self.editor.sig_key_pressed.connect(self._on_key_pressed) else: self.editor.sig_key_pressed.disconnect(self._on_key_pressed)
python
def on_state_changed(self, state): """Connect/disconnect sig_key_pressed signal.""" if state: self.editor.sig_key_pressed.connect(self._on_key_pressed) else: self.editor.sig_key_pressed.disconnect(self._on_key_pressed)
[ "def", "on_state_changed", "(", "self", ",", "state", ")", ":", "if", "state", ":", "self", ".", "editor", ".", "sig_key_pressed", ".", "connect", "(", "self", ".", "_on_key_pressed", ")", "else", ":", "self", ".", "editor", ".", "sig_key_pressed", ".", ...
Connect/disconnect sig_key_pressed signal.
[ "Connect", "/", "disconnect", "sig_key_pressed", "signal", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L44-L49
train
spyder-ide/spyder
spyder/plugins/editor/extensions/closequotes.py
CloseQuotesExtension._autoinsert_quotes
def _autoinsert_quotes(self, key): """Control how to automatically insert quotes in various situations.""" char = {Qt.Key_QuoteDbl: '"', Qt.Key_Apostrophe: '\''}[key] line_text = self.editor.get_text('sol', 'eol') line_to_cursor = self.editor.get_text('sol', 'cursor') cursor = s...
python
def _autoinsert_quotes(self, key): """Control how to automatically insert quotes in various situations.""" char = {Qt.Key_QuoteDbl: '"', Qt.Key_Apostrophe: '\''}[key] line_text = self.editor.get_text('sol', 'eol') line_to_cursor = self.editor.get_text('sol', 'cursor') cursor = s...
[ "def", "_autoinsert_quotes", "(", "self", ",", "key", ")", ":", "char", "=", "{", "Qt", ".", "Key_QuoteDbl", ":", "'\"'", ",", "Qt", ".", "Key_Apostrophe", ":", "'\\''", "}", "[", "key", "]", "line_text", "=", "self", ".", "editor", ".", "get_text", ...
Control how to automatically insert quotes in various situations.
[ "Control", "how", "to", "automatically", "insert", "quotes", "in", "various", "situations", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L61-L113
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
populate
def populate(combobox, data): """ Populate the given ``combobox`` with the class or function names. Parameters ---------- combobox : :class:`qtpy.QtWidets.QComboBox` The combobox to populate data : list of :class:`FoldScopeHelper` The data to populate with. There should be one l...
python
def populate(combobox, data): """ Populate the given ``combobox`` with the class or function names. Parameters ---------- combobox : :class:`qtpy.QtWidets.QComboBox` The combobox to populate data : list of :class:`FoldScopeHelper` The data to populate with. There should be one l...
[ "def", "populate", "(", "combobox", ",", "data", ")", ":", "combobox", ".", "clear", "(", ")", "combobox", ".", "addItem", "(", "\"<None>\"", ",", "0", ")", "# First create a list of fully-qualified names.", "cb_data", "=", "[", "]", "for", "item", "in", "da...
Populate the given ``combobox`` with the class or function names. Parameters ---------- combobox : :class:`qtpy.QtWidets.QComboBox` The combobox to populate data : list of :class:`FoldScopeHelper` The data to populate with. There should be one list element per class or function ...
[ "Populate", "the", "given", "combobox", "with", "the", "class", "or", "function", "names", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L32-L77
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
_get_fold_levels
def _get_fold_levels(editor): """ Return a list of all the class/function definition ranges. Parameters ---------- editor : :class:`spyder.plugins.editor.widgets.codeeditor.CodeEditor` Returns ------- folds : list of :class:`FoldScopeHelper` A list of all the class or function ...
python
def _get_fold_levels(editor): """ Return a list of all the class/function definition ranges. Parameters ---------- editor : :class:`spyder.plugins.editor.widgets.codeeditor.CodeEditor` Returns ------- folds : list of :class:`FoldScopeHelper` A list of all the class or function ...
[ "def", "_get_fold_levels", "(", "editor", ")", ":", "block", "=", "editor", ".", "document", "(", ")", ".", "firstBlock", "(", ")", "oed", "=", "editor", ".", "get_outlineexplorer_data", "(", ")", "folds", "=", "[", "]", "parents", "=", "[", "]", "prev...
Return a list of all the class/function definition ranges. Parameters ---------- editor : :class:`spyder.plugins.editor.widgets.codeeditor.CodeEditor` Returns ------- folds : list of :class:`FoldScopeHelper` A list of all the class or function defintion fold points.
[ "Return", "a", "list", "of", "all", "the", "class", "/", "function", "definition", "ranges", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L80-L120
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
_adjust_parent_stack
def _adjust_parent_stack(fsh, prev, parents): """ Adjust the parent stack in-place as the trigger level changes. Parameters ---------- fsh : :class:`FoldScopeHelper` The :class:`FoldScopeHelper` object to act on. prev : :class:`FoldScopeHelper` The previous :class:`FoldScopeHelp...
python
def _adjust_parent_stack(fsh, prev, parents): """ Adjust the parent stack in-place as the trigger level changes. Parameters ---------- fsh : :class:`FoldScopeHelper` The :class:`FoldScopeHelper` object to act on. prev : :class:`FoldScopeHelper` The previous :class:`FoldScopeHelp...
[ "def", "_adjust_parent_stack", "(", "fsh", ",", "prev", ",", "parents", ")", ":", "if", "prev", "is", "None", ":", "return", "if", "fsh", ".", "fold_scope", ".", "trigger_level", "<", "prev", ".", "fold_scope", ".", "trigger_level", ":", "diff", "=", "pr...
Adjust the parent stack in-place as the trigger level changes. Parameters ---------- fsh : :class:`FoldScopeHelper` The :class:`FoldScopeHelper` object to act on. prev : :class:`FoldScopeHelper` The previous :class:`FoldScopeHelper` object. parents : list of :class:`FoldScopeHelper`...
[ "Adjust", "the", "parent", "stack", "in", "-", "place", "as", "the", "trigger", "level", "changes", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L123-L149
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
_split_classes_and_methods
def _split_classes_and_methods(folds): """ Split out classes and methods into two separate lists. Parameters ---------- folds : list of :class:`FoldScopeHelper` The result of :func:`_get_fold_levels`. Returns ------- classes, functions: list of :class:`FoldScopeHelper` ...
python
def _split_classes_and_methods(folds): """ Split out classes and methods into two separate lists. Parameters ---------- folds : list of :class:`FoldScopeHelper` The result of :func:`_get_fold_levels`. Returns ------- classes, functions: list of :class:`FoldScopeHelper` ...
[ "def", "_split_classes_and_methods", "(", "folds", ")", ":", "classes", "=", "[", "]", "functions", "=", "[", "]", "for", "fold", "in", "folds", ":", "if", "fold", ".", "def_type", "==", "OED", ".", "FUNCTION_TOKEN", ":", "functions", ".", "append", "(",...
Split out classes and methods into two separate lists. Parameters ---------- folds : list of :class:`FoldScopeHelper` The result of :func:`_get_fold_levels`. Returns ------- classes, functions: list of :class:`FoldScopeHelper` Two separate lists of :class:`FoldScopeHelper` obje...
[ "Split", "out", "classes", "and", "methods", "into", "two", "separate", "lists", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L152-L176
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
_get_parents
def _get_parents(folds, linenum): """ Get the parents at a given linenum. If parents is empty, then the linenum belongs to the module. Parameters ---------- folds : list of :class:`FoldScopeHelper` linenum : int The line number to get parents for. Typically this would be the ...
python
def _get_parents(folds, linenum): """ Get the parents at a given linenum. If parents is empty, then the linenum belongs to the module. Parameters ---------- folds : list of :class:`FoldScopeHelper` linenum : int The line number to get parents for. Typically this would be the ...
[ "def", "_get_parents", "(", "folds", ",", "linenum", ")", ":", "# Note: this might be able to be sped up by finding some kind of", "# abort-early condition.", "parents", "=", "[", "]", "for", "fold", "in", "folds", ":", "start", ",", "end", "=", "fold", ".", "range"...
Get the parents at a given linenum. If parents is empty, then the linenum belongs to the module. Parameters ---------- folds : list of :class:`FoldScopeHelper` linenum : int The line number to get parents for. Typically this would be the cursor position. Returns ------- ...
[ "Get", "the", "parents", "at", "a", "given", "linenum", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L179-L210
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
update_selected_cb
def update_selected_cb(parents, combobox): """ Update the combobox with the selected item based on the parents. Parameters ---------- parents : list of :class:`FoldScopeHelper` combobox : :class:`qtpy.QtWidets.QComboBox` The combobox to populate Returns ------- None """...
python
def update_selected_cb(parents, combobox): """ Update the combobox with the selected item based on the parents. Parameters ---------- parents : list of :class:`FoldScopeHelper` combobox : :class:`qtpy.QtWidets.QComboBox` The combobox to populate Returns ------- None """...
[ "def", "update_selected_cb", "(", "parents", ",", "combobox", ")", ":", "if", "parents", "is", "not", "None", "and", "len", "(", "parents", ")", "==", "0", ":", "combobox", ".", "setCurrentIndex", "(", "0", ")", "else", ":", "item", "=", "parents", "["...
Update the combobox with the selected item based on the parents. Parameters ---------- parents : list of :class:`FoldScopeHelper` combobox : :class:`qtpy.QtWidets.QComboBox` The combobox to populate Returns ------- None
[ "Update", "the", "combobox", "with", "the", "selected", "item", "based", "on", "the", "parents", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L213-L234
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
ClassFunctionDropdown._update_data
def _update_data(self): """Update the internal data values.""" _old = self.folds self.folds = _get_fold_levels(self.editor) # only update our dropdown lists if the folds have changed. if self.folds != _old: self.classes, self.funcs = _split_classes_and_methods(self.f...
python
def _update_data(self): """Update the internal data values.""" _old = self.folds self.folds = _get_fold_levels(self.editor) # only update our dropdown lists if the folds have changed. if self.folds != _old: self.classes, self.funcs = _split_classes_and_methods(self.f...
[ "def", "_update_data", "(", "self", ")", ":", "_old", "=", "self", ".", "folds", "self", ".", "folds", "=", "_get_fold_levels", "(", "self", ".", "editor", ")", "# only update our dropdown lists if the folds have changed.", "if", "self", ".", "folds", "!=", "_ol...
Update the internal data values.
[ "Update", "the", "internal", "data", "values", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L378-L386
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
ClassFunctionDropdown.combobox_activated
def combobox_activated(self): """Move the cursor to the selected definition.""" sender = self.sender() data = sender.itemData(sender.currentIndex()) if isinstance(data, FoldScopeHelper): self.editor.go_to_line(data.line + 1)
python
def combobox_activated(self): """Move the cursor to the selected definition.""" sender = self.sender() data = sender.itemData(sender.currentIndex()) if isinstance(data, FoldScopeHelper): self.editor.go_to_line(data.line + 1)
[ "def", "combobox_activated", "(", "self", ")", ":", "sender", "=", "self", ".", "sender", "(", ")", "data", "=", "sender", ".", "itemData", "(", "sender", ".", "currentIndex", "(", ")", ")", "if", "isinstance", "(", "data", ",", "FoldScopeHelper", ")", ...
Move the cursor to the selected definition.
[ "Move", "the", "cursor", "to", "the", "selected", "definition", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L395-L401
train
spyder-ide/spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
ClassFunctionDropdown.update_selected
def update_selected(self, linenum): """Updates the dropdowns to reflect the current class and function.""" self.parents = _get_parents(self.funcs, linenum) update_selected_cb(self.parents, self.method_cb) self.parents = _get_parents(self.classes, linenum) update_selected_cb(self...
python
def update_selected(self, linenum): """Updates the dropdowns to reflect the current class and function.""" self.parents = _get_parents(self.funcs, linenum) update_selected_cb(self.parents, self.method_cb) self.parents = _get_parents(self.classes, linenum) update_selected_cb(self...
[ "def", "update_selected", "(", "self", ",", "linenum", ")", ":", "self", ".", "parents", "=", "_get_parents", "(", "self", ".", "funcs", ",", "linenum", ")", "update_selected_cb", "(", "self", ".", "parents", ",", "self", ".", "method_cb", ")", "self", "...
Updates the dropdowns to reflect the current class and function.
[ "Updates", "the", "dropdowns", "to", "reflect", "the", "current", "class", "and", "function", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L403-L409
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.set_palette
def set_palette(self, background, foreground): """ Set text editor palette colors: background color and caret (text cursor) color """ palette = QPalette() palette.setColor(QPalette.Base, background) palette.setColor(QPalette.Text, foreground) self....
python
def set_palette(self, background, foreground): """ Set text editor palette colors: background color and caret (text cursor) color """ palette = QPalette() palette.setColor(QPalette.Base, background) palette.setColor(QPalette.Text, foreground) self....
[ "def", "set_palette", "(", "self", ",", "background", ",", "foreground", ")", ":", "palette", "=", "QPalette", "(", ")", "palette", ".", "setColor", "(", "QPalette", ".", "Base", ",", "background", ")", "palette", ".", "setColor", "(", "QPalette", ".", "...
Set text editor palette colors: background color and caret (text cursor) color
[ "Set", "text", "editor", "palette", "colors", ":", "background", "color", "and", "caret", "(", "text", "cursor", ")", "color" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L336-L352
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.set_extra_selections
def set_extra_selections(self, key, extra_selections): """Set extra selections for a key. Also assign draw orders to leave current_cell and current_line in the backgrund (and avoid them to cover other decorations) NOTE: This will remove previous decorations added to the same key...
python
def set_extra_selections(self, key, extra_selections): """Set extra selections for a key. Also assign draw orders to leave current_cell and current_line in the backgrund (and avoid them to cover other decorations) NOTE: This will remove previous decorations added to the same key...
[ "def", "set_extra_selections", "(", "self", ",", "key", ",", "extra_selections", ")", ":", "# use draw orders to highlight current_cell and current_line first\r", "draw_order", "=", "DRAW_ORDERS", ".", "get", "(", "key", ")", "if", "draw_order", "is", "None", ":", "dr...
Set extra selections for a key. Also assign draw orders to leave current_cell and current_line in the backgrund (and avoid them to cover other decorations) NOTE: This will remove previous decorations added to the same key. Args: key (str) name of the extra selecti...
[ "Set", "extra", "selections", "for", "a", "key", ".", "Also", "assign", "draw", "orders", "to", "leave", "current_cell", "and", "current_line", "in", "the", "backgrund", "(", "and", "avoid", "them", "to", "cover", "other", "decorations", ")", "NOTE", ":", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L367-L388
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.update_extra_selections
def update_extra_selections(self): """Add extra selections to DecorationsManager. TODO: This method could be remove it and decorations could be added/removed in set_extra_selections/clear_extra_selections. """ extra_selections = [] for key, extra in list(self.ex...
python
def update_extra_selections(self): """Add extra selections to DecorationsManager. TODO: This method could be remove it and decorations could be added/removed in set_extra_selections/clear_extra_selections. """ extra_selections = [] for key, extra in list(self.ex...
[ "def", "update_extra_selections", "(", "self", ")", ":", "extra_selections", "=", "[", "]", "for", "key", ",", "extra", "in", "list", "(", "self", ".", "extra_selections_dict", ".", "items", "(", ")", ")", ":", "extra_selections", ".", "extend", "(", "extr...
Add extra selections to DecorationsManager. TODO: This method could be remove it and decorations could be added/removed in set_extra_selections/clear_extra_selections.
[ "Add", "extra", "selections", "to", "DecorationsManager", ".", "TODO", ":", "This", "method", "could", "be", "remove", "it", "and", "decorations", "could", "be", "added", "/", "removed", "in", "set_extra_selections", "/", "clear_extra_selections", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L390-L400
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.clear_extra_selections
def clear_extra_selections(self, key): """Remove decorations added through set_extra_selections. Args: key (str) name of the extra selections group. """ for decoration in self.extra_selections_dict.get(key, []): self.decorations.remove(decoration) ...
python
def clear_extra_selections(self, key): """Remove decorations added through set_extra_selections. Args: key (str) name of the extra selections group. """ for decoration in self.extra_selections_dict.get(key, []): self.decorations.remove(decoration) ...
[ "def", "clear_extra_selections", "(", "self", ",", "key", ")", ":", "for", "decoration", "in", "self", ".", "extra_selections_dict", ".", "get", "(", "key", ",", "[", "]", ")", ":", "self", ".", "decorations", ".", "remove", "(", "decoration", ")", "self...
Remove decorations added through set_extra_selections. Args: key (str) name of the extra selections group.
[ "Remove", "decorations", "added", "through", "set_extra_selections", ".", "Args", ":", "key", "(", "str", ")", "name", "of", "the", "extra", "selections", "group", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L402-L410
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.highlight_current_line
def highlight_current_line(self): """Highlight current line""" selection = TextDecoration(self.textCursor()) selection.format.setProperty(QTextFormat.FullWidthSelection, to_qvariant(True)) selection.format.setBackground(self.currentline_color) ...
python
def highlight_current_line(self): """Highlight current line""" selection = TextDecoration(self.textCursor()) selection.format.setProperty(QTextFormat.FullWidthSelection, to_qvariant(True)) selection.format.setBackground(self.currentline_color) ...
[ "def", "highlight_current_line", "(", "self", ")", ":", "selection", "=", "TextDecoration", "(", "self", ".", "textCursor", "(", ")", ")", "selection", ".", "format", ".", "setProperty", "(", "QTextFormat", ".", "FullWidthSelection", ",", "to_qvariant", "(", "...
Highlight current line
[ "Highlight", "current", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L418-L426
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.highlight_current_cell
def highlight_current_cell(self): """Highlight current cell""" if self.cell_separators is None or \ not self.highlight_current_cell_enabled: return cursor, whole_file_selected, whole_screen_selected =\ self.select_current_cell_in_visible_portion() ...
python
def highlight_current_cell(self): """Highlight current cell""" if self.cell_separators is None or \ not self.highlight_current_cell_enabled: return cursor, whole_file_selected, whole_screen_selected =\ self.select_current_cell_in_visible_portion() ...
[ "def", "highlight_current_cell", "(", "self", ")", ":", "if", "self", ".", "cell_separators", "is", "None", "or", "not", "self", ".", "highlight_current_cell_enabled", ":", "return", "cursor", ",", "whole_file_selected", ",", "whole_screen_selected", "=", "self", ...
Highlight current cell
[ "Highlight", "current", "cell" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L433-L455
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.cursor_position_changed
def cursor_position_changed(self): """Brace matching""" if self.bracepos is not None: self.__highlight(self.bracepos, cancel=True) self.bracepos = None cursor = self.textCursor() if cursor.position() == 0: return cursor.movePosition(QTe...
python
def cursor_position_changed(self): """Brace matching""" if self.bracepos is not None: self.__highlight(self.bracepos, cancel=True) self.bracepos = None cursor = self.textCursor() if cursor.position() == 0: return cursor.movePosition(QTe...
[ "def", "cursor_position_changed", "(", "self", ")", ":", "if", "self", ".", "bracepos", "is", "not", "None", ":", "self", ".", "__highlight", "(", "self", ".", "bracepos", ",", "cancel", "=", "True", ")", "self", ".", "bracepos", "=", "None", "cursor", ...
Brace matching
[ "Brace", "matching" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L520-L543
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.set_wrap_mode
def set_wrap_mode(self, mode=None): """ Set wrap mode Valid *mode* values: None, 'word', 'character' """ if mode == 'word': wrap_mode = QTextOption.WrapAtWordBoundaryOrAnywhere elif mode == 'character': wrap_mode = QTextOption.WrapAnywhere ...
python
def set_wrap_mode(self, mode=None): """ Set wrap mode Valid *mode* values: None, 'word', 'character' """ if mode == 'word': wrap_mode = QTextOption.WrapAtWordBoundaryOrAnywhere elif mode == 'character': wrap_mode = QTextOption.WrapAnywhere ...
[ "def", "set_wrap_mode", "(", "self", ",", "mode", "=", "None", ")", ":", "if", "mode", "==", "'word'", ":", "wrap_mode", "=", "QTextOption", ".", "WrapAtWordBoundaryOrAnywhere", "elif", "mode", "==", "'character'", ":", "wrap_mode", "=", "QTextOption", ".", ...
Set wrap mode Valid *mode* values: None, 'word', 'character'
[ "Set", "wrap", "mode", "Valid", "*", "mode", "*", "values", ":", "None", "word", "character" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L551-L562
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.toPlainText
def toPlainText(self): """ Reimplement Qt method Fix PyQt4 bug on Windows and Python 3 """ # Fix what appears to be a PyQt4 bug when getting file # contents under Windows and PY3. This bug leads to # corruptions when saving files with certain combinations ...
python
def toPlainText(self): """ Reimplement Qt method Fix PyQt4 bug on Windows and Python 3 """ # Fix what appears to be a PyQt4 bug when getting file # contents under Windows and PY3. This bug leads to # corruptions when saving files with certain combinations ...
[ "def", "toPlainText", "(", "self", ")", ":", "# Fix what appears to be a PyQt4 bug when getting file\r", "# contents under Windows and PY3. This bug leads to\r", "# corruptions when saving files with certain combinations\r", "# of unicode chars on them (like the one attached on\r", "# Issue 1546...
Reimplement Qt method Fix PyQt4 bug on Windows and Python 3
[ "Reimplement", "Qt", "method", "Fix", "PyQt4", "bug", "on", "Windows", "and", "Python", "3" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L575-L590
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.get_selection_as_executable_code
def get_selection_as_executable_code(self): """Return selected text as a processed text, to be executable in a Python/IPython interpreter""" ls = self.get_line_separator() _indent = lambda line: len(line)-len(line.lstrip()) line_from, line_to = self.get_selection_bounds(...
python
def get_selection_as_executable_code(self): """Return selected text as a processed text, to be executable in a Python/IPython interpreter""" ls = self.get_line_separator() _indent = lambda line: len(line)-len(line.lstrip()) line_from, line_to = self.get_selection_bounds(...
[ "def", "get_selection_as_executable_code", "(", "self", ")", ":", "ls", "=", "self", ".", "get_line_separator", "(", ")", "_indent", "=", "lambda", "line", ":", "len", "(", "line", ")", "-", "len", "(", "line", ".", "lstrip", "(", ")", ")", "line_from", ...
Return selected text as a processed text, to be executable in a Python/IPython interpreter
[ "Return", "selected", "text", "as", "a", "processed", "text", "to", "be", "executable", "in", "a", "Python", "/", "IPython", "interpreter" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L604-L658
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.is_cell_separator
def is_cell_separator(self, cursor=None, block=None): """Return True if cursor (or text block) is on a block separator""" assert cursor is not None or block is not None if cursor is not None: cursor0 = QTextCursor(cursor) cursor0.select(QTextCursor.BlockUnderCursor) ...
python
def is_cell_separator(self, cursor=None, block=None): """Return True if cursor (or text block) is on a block separator""" assert cursor is not None or block is not None if cursor is not None: cursor0 = QTextCursor(cursor) cursor0.select(QTextCursor.BlockUnderCursor) ...
[ "def", "is_cell_separator", "(", "self", ",", "cursor", "=", "None", ",", "block", "=", "None", ")", ":", "assert", "cursor", "is", "not", "None", "or", "block", "is", "not", "None", "if", "cursor", "is", "not", "None", ":", "cursor0", "=", "QTextCurso...
Return True if cursor (or text block) is on a block separator
[ "Return", "True", "if", "cursor", "(", "or", "text", "block", ")", "is", "on", "a", "block", "separator" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L686-L698
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.select_current_cell
def select_current_cell(self): """Select cell under cursor cell = group of lines separated by CELL_SEPARATORS returns the textCursor and a boolean indicating if the entire file is selected""" cursor = self.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) ...
python
def select_current_cell(self): """Select cell under cursor cell = group of lines separated by CELL_SEPARATORS returns the textCursor and a boolean indicating if the entire file is selected""" cursor = self.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) ...
[ "def", "select_current_cell", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "StartOfBlock", ")", "cur_pos", "=", "prev_pos", "=", "cursor", ".", "position", "(", ")", "# M...
Select cell under cursor cell = group of lines separated by CELL_SEPARATORS returns the textCursor and a boolean indicating if the entire file is selected
[ "Select", "cell", "under", "cursor", "cell", "=", "group", "of", "lines", "separated", "by", "CELL_SEPARATORS", "returns", "the", "textCursor", "and", "a", "boolean", "indicating", "if", "the", "entire", "file", "is", "selected" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L700-L743
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.select_current_cell_in_visible_portion
def select_current_cell_in_visible_portion(self): """Select cell under cursor in the visible portion of the file cell = group of lines separated by CELL_SEPARATORS returns -the textCursor -a boolean indicating if the entire file is selected -a boolean indicating ...
python
def select_current_cell_in_visible_portion(self): """Select cell under cursor in the visible portion of the file cell = group of lines separated by CELL_SEPARATORS returns -the textCursor -a boolean indicating if the entire file is selected -a boolean indicating ...
[ "def", "select_current_cell_in_visible_portion", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "StartOfBlock", ")", "cur_pos", "=", "prev_pos", "=", "cursor", ".", "position", ...
Select cell under cursor in the visible portion of the file cell = group of lines separated by CELL_SEPARATORS returns -the textCursor -a boolean indicating if the entire file is selected -a boolean indicating if the entire visible portion of the file is selected
[ "Select", "cell", "under", "cursor", "in", "the", "visible", "portion", "of", "the", "file", "cell", "=", "group", "of", "lines", "separated", "by", "CELL_SEPARATORS", "returns", "-", "the", "textCursor", "-", "a", "boolean", "indicating", "if", "the", "enti...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L745-L806
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.go_to_next_cell
def go_to_next_cell(self): """Go to the next cell of lines""" cursor = self.textCursor() cursor.movePosition(QTextCursor.NextBlock) cur_pos = prev_pos = cursor.position() while not self.is_cell_separator(cursor): # Moving to the next code cell curso...
python
def go_to_next_cell(self): """Go to the next cell of lines""" cursor = self.textCursor() cursor.movePosition(QTextCursor.NextBlock) cur_pos = prev_pos = cursor.position() while not self.is_cell_separator(cursor): # Moving to the next code cell curso...
[ "def", "go_to_next_cell", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "NextBlock", ")", "cur_pos", "=", "prev_pos", "=", "cursor", ".", "position", "(", ")", "while", ...
Go to the next cell of lines
[ "Go", "to", "the", "next", "cell", "of", "lines" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L808-L820
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.go_to_previous_cell
def go_to_previous_cell(self): """Go to the previous cell of lines""" cursor = self.textCursor() cur_pos = prev_pos = cursor.position() if self.is_cell_separator(cursor): # Move to the previous cell cursor.movePosition(QTextCursor.PreviousBlock) ...
python
def go_to_previous_cell(self): """Go to the previous cell of lines""" cursor = self.textCursor() cur_pos = prev_pos = cursor.position() if self.is_cell_separator(cursor): # Move to the previous cell cursor.movePosition(QTextCursor.PreviousBlock) ...
[ "def", "go_to_previous_cell", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cur_pos", "=", "prev_pos", "=", "cursor", ".", "position", "(", ")", "if", "self", ".", "is_cell_separator", "(", "cursor", ")", ":", "# Move to the p...
Go to the previous cell of lines
[ "Go", "to", "the", "previous", "cell", "of", "lines" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L822-L840
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.__restore_selection
def __restore_selection(self, start_pos, end_pos): """Restore cursor selection from position bounds""" cursor = self.textCursor() cursor.setPosition(start_pos) cursor.setPosition(end_pos, QTextCursor.KeepAnchor) self.setTextCursor(cursor)
python
def __restore_selection(self, start_pos, end_pos): """Restore cursor selection from position bounds""" cursor = self.textCursor() cursor.setPosition(start_pos) cursor.setPosition(end_pos, QTextCursor.KeepAnchor) self.setTextCursor(cursor)
[ "def", "__restore_selection", "(", "self", ",", "start_pos", ",", "end_pos", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "setPosition", "(", "start_pos", ")", "cursor", ".", "setPosition", "(", "end_pos", ",", "QTextCursor", ...
Restore cursor selection from position bounds
[ "Restore", "cursor", "selection", "from", "position", "bounds" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L851-L856
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.__duplicate_line_or_selection
def __duplicate_line_or_selection(self, after_current_line=True): """Duplicate current line or selected text""" cursor = self.textCursor() cursor.beginEditBlock() start_pos, end_pos = self.__save_selection() if to_text_string(cursor.selectedText()): cursor.setPo...
python
def __duplicate_line_or_selection(self, after_current_line=True): """Duplicate current line or selected text""" cursor = self.textCursor() cursor.beginEditBlock() start_pos, end_pos = self.__save_selection() if to_text_string(cursor.selectedText()): cursor.setPo...
[ "def", "__duplicate_line_or_selection", "(", "self", ",", "after_current_line", "=", "True", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "beginEditBlock", "(", ")", "start_pos", ",", "end_pos", "=", "self", ".", "__save_selecti...
Duplicate current line or selected text
[ "Duplicate", "current", "line", "or", "selected", "text" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L858-L896
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.__move_line_or_selection
def __move_line_or_selection(self, after_current_line=True): """Move current line or selected text""" cursor = self.textCursor() cursor.beginEditBlock() start_pos, end_pos = self.__save_selection() last_line = False # ------ Select text # Get selection ...
python
def __move_line_or_selection(self, after_current_line=True): """Move current line or selected text""" cursor = self.textCursor() cursor.beginEditBlock() start_pos, end_pos = self.__save_selection() last_line = False # ------ Select text # Get selection ...
[ "def", "__move_line_or_selection", "(", "self", ",", "after_current_line", "=", "True", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "beginEditBlock", "(", ")", "start_pos", ",", "end_pos", "=", "self", ".", "__save_selection", ...
Move current line or selected text
[ "Move", "current", "line", "or", "selected", "text" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L912-L989
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.go_to_new_line
def go_to_new_line(self): """Go to the end of the current line and create a new line""" self.stdkey_end(False, False) self.insert_text(self.get_line_separator())
python
def go_to_new_line(self): """Go to the end of the current line and create a new line""" self.stdkey_end(False, False) self.insert_text(self.get_line_separator())
[ "def", "go_to_new_line", "(", "self", ")", ":", "self", ".", "stdkey_end", "(", "False", ",", "False", ")", "self", ".", "insert_text", "(", "self", ".", "get_line_separator", "(", ")", ")" ]
Go to the end of the current line and create a new line
[ "Go", "to", "the", "end", "of", "the", "current", "line", "and", "create", "a", "new", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L999-L1002
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.extend_selection_to_complete_lines
def extend_selection_to_complete_lines(self): """Extend current selection to complete lines""" cursor = self.textCursor() start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd() cursor.setPosition(start_pos) cursor.setPosition(end_pos, QTextCursor.KeepAnchor) ...
python
def extend_selection_to_complete_lines(self): """Extend current selection to complete lines""" cursor = self.textCursor() start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd() cursor.setPosition(start_pos) cursor.setPosition(end_pos, QTextCursor.KeepAnchor) ...
[ "def", "extend_selection_to_complete_lines", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "start_pos", ",", "end_pos", "=", "cursor", ".", "selectionStart", "(", ")", ",", "cursor", ".", "selectionEnd", "(", ")", "cursor", ".", ...
Extend current selection to complete lines
[ "Extend", "current", "selection", "to", "complete", "lines" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1004-L1015
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.delete_line
def delete_line(self): """Delete current line""" cursor = self.textCursor() if self.has_selected_text(): self.extend_selection_to_complete_lines() start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd() cursor.setPosition(start_pos) ...
python
def delete_line(self): """Delete current line""" cursor = self.textCursor() if self.has_selected_text(): self.extend_selection_to_complete_lines() start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd() cursor.setPosition(start_pos) ...
[ "def", "delete_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "if", "self", ".", "has_selected_text", "(", ")", ":", "self", ".", "extend_selection_to_complete_lines", "(", ")", "start_pos", ",", "end_pos", "=", "cursor", ...
Delete current line
[ "Delete", "current", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1017-L1036
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.truncate_selection
def truncate_selection(self, position_from): """Unselect read-only parts in shell, like prompt""" position_from = self.get_position(position_from) cursor = self.textCursor() start, end = cursor.selectionStart(), cursor.selectionEnd() if start < end: start = max(...
python
def truncate_selection(self, position_from): """Unselect read-only parts in shell, like prompt""" position_from = self.get_position(position_from) cursor = self.textCursor() start, end = cursor.selectionStart(), cursor.selectionEnd() if start < end: start = max(...
[ "def", "truncate_selection", "(", "self", ",", "position_from", ")", ":", "position_from", "=", "self", ".", "get_position", "(", "position_from", ")", "cursor", "=", "self", ".", "textCursor", "(", ")", "start", ",", "end", "=", "cursor", ".", "selectionSta...
Unselect read-only parts in shell, like prompt
[ "Unselect", "read", "-", "only", "parts", "in", "shell", "like", "prompt" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1044-L1053
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.restrict_cursor_position
def restrict_cursor_position(self, position_from, position_to): """In shell, avoid editing text except between prompt and EOF""" position_from = self.get_position(position_from) position_to = self.get_position(position_to) cursor = self.textCursor() cursor_position = cursor....
python
def restrict_cursor_position(self, position_from, position_to): """In shell, avoid editing text except between prompt and EOF""" position_from = self.get_position(position_from) position_to = self.get_position(position_to) cursor = self.textCursor() cursor_position = cursor....
[ "def", "restrict_cursor_position", "(", "self", ",", "position_from", ",", "position_to", ")", ":", "position_from", "=", "self", ".", "get_position", "(", "position_from", ")", "position_to", "=", "self", ".", "get_position", "(", "position_to", ")", "cursor", ...
In shell, avoid editing text except between prompt and EOF
[ "In", "shell", "avoid", "editing", "text", "except", "between", "prompt", "and", "EOF" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1055-L1062
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.hide_tooltip_if_necessary
def hide_tooltip_if_necessary(self, key): """Hide calltip when necessary""" try: calltip_char = self.get_character(self.calltip_position) before = self.is_cursor_before(self.calltip_position, char_offset=1) other = key ...
python
def hide_tooltip_if_necessary(self, key): """Hide calltip when necessary""" try: calltip_char = self.get_character(self.calltip_position) before = self.is_cursor_before(self.calltip_position, char_offset=1) other = key ...
[ "def", "hide_tooltip_if_necessary", "(", "self", ",", "key", ")", ":", "try", ":", "calltip_char", "=", "self", ".", "get_character", "(", "self", ".", "calltip_position", ")", "before", "=", "self", ".", "is_cursor_before", "(", "self", ".", "calltip_position...
Hide calltip when necessary
[ "Hide", "calltip", "when", "necessary" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1065-L1075
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.stdkey_home
def stdkey_home(self, shift, ctrl, prompt_pos=None): """Smart HOME feature: cursor is first moved at indentation position, then at the start of the line""" move_mode = self.__get_move_mode(shift) if ctrl: self.moveCursor(QTextCursor.Start, move_mode) else: ...
python
def stdkey_home(self, shift, ctrl, prompt_pos=None): """Smart HOME feature: cursor is first moved at indentation position, then at the start of the line""" move_mode = self.__get_move_mode(shift) if ctrl: self.moveCursor(QTextCursor.Start, move_mode) else: ...
[ "def", "stdkey_home", "(", "self", ",", "shift", ",", "ctrl", ",", "prompt_pos", "=", "None", ")", ":", "move_mode", "=", "self", ".", "__get_move_mode", "(", "shift", ")", "if", "ctrl", ":", "self", ".", "moveCursor", "(", "QTextCursor", ".", "Start", ...
Smart HOME feature: cursor is first moved at indentation position, then at the start of the line
[ "Smart", "HOME", "feature", ":", "cursor", "is", "first", "moved", "at", "indentation", "position", "then", "at", "the", "start", "of", "the", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1130-L1148
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.mousePressEvent
def mousePressEvent(self, event): """Reimplement Qt method""" if sys.platform.startswith('linux') and event.button() == Qt.MidButton: self.calltip_widget.hide() self.setFocus() event = QMouseEvent(QEvent.MouseButtonPress, event.pos(), ...
python
def mousePressEvent(self, event): """Reimplement Qt method""" if sys.platform.startswith('linux') and event.button() == Qt.MidButton: self.calltip_widget.hide() self.setFocus() event = QMouseEvent(QEvent.MouseButtonPress, event.pos(), ...
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", "and", "event", ".", "button", "(", ")", "==", "Qt", ".", "MidButton", ":", "self", ".", "calltip_widget", ".", "hide",...
Reimplement Qt method
[ "Reimplement", "Qt", "method" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1168-L1190
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.focusInEvent
def focusInEvent(self, event): """Reimplemented to handle focus""" self.focus_changed.emit() self.focus_in.emit() self.highlight_current_cell() QPlainTextEdit.focusInEvent(self, event)
python
def focusInEvent(self, event): """Reimplemented to handle focus""" self.focus_changed.emit() self.focus_in.emit() self.highlight_current_cell() QPlainTextEdit.focusInEvent(self, event)
[ "def", "focusInEvent", "(", "self", ",", "event", ")", ":", "self", ".", "focus_changed", ".", "emit", "(", ")", "self", ".", "focus_in", ".", "emit", "(", ")", "self", ".", "highlight_current_cell", "(", ")", "QPlainTextEdit", ".", "focusInEvent", "(", ...
Reimplemented to handle focus
[ "Reimplemented", "to", "handle", "focus" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1192-L1197
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.focusOutEvent
def focusOutEvent(self, event): """Reimplemented to handle focus""" self.focus_changed.emit() QPlainTextEdit.focusOutEvent(self, event)
python
def focusOutEvent(self, event): """Reimplemented to handle focus""" self.focus_changed.emit() QPlainTextEdit.focusOutEvent(self, event)
[ "def", "focusOutEvent", "(", "self", ",", "event", ")", ":", "self", ".", "focus_changed", ".", "emit", "(", ")", "QPlainTextEdit", ".", "focusOutEvent", "(", "self", ",", "event", ")" ]
Reimplemented to handle focus
[ "Reimplemented", "to", "handle", "focus" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1199-L1202
train
spyder-ide/spyder
spyder/plugins/editor/widgets/base.py
TextEditBaseWidget.wheelEvent
def wheelEvent(self, event): """Reimplemented to emit zoom in/out signals when Ctrl is pressed""" # This feature is disabled on MacOS, see Issue 1510 if sys.platform != 'darwin': if event.modifiers() & Qt.ControlModifier: if hasattr(event, 'angleDelta'): ...
python
def wheelEvent(self, event): """Reimplemented to emit zoom in/out signals when Ctrl is pressed""" # This feature is disabled on MacOS, see Issue 1510 if sys.platform != 'darwin': if event.modifiers() & Qt.ControlModifier: if hasattr(event, 'angleDelta'): ...
[ "def", "wheelEvent", "(", "self", ",", "event", ")", ":", "# This feature is disabled on MacOS, see Issue 1510\r", "if", "sys", ".", "platform", "!=", "'darwin'", ":", "if", "event", ".", "modifiers", "(", ")", "&", "Qt", ".", "ControlModifier", ":", "if", "ha...
Reimplemented to emit zoom in/out signals when Ctrl is pressed
[ "Reimplemented", "to", "emit", "zoom", "in", "/", "out", "signals", "when", "Ctrl", "is", "pressed" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1204-L1221
train
spyder-ide/spyder
spyder/app/cli_options.py
get_options
def get_options(argv=None): """ Convert options into commands return commands, message """ parser = argparse.ArgumentParser(usage="spyder [options] files") parser.add_argument('--new-instance', action='store_true', default=False, help="Run a new instance of Spyder, even if ...
python
def get_options(argv=None): """ Convert options into commands return commands, message """ parser = argparse.ArgumentParser(usage="spyder [options] files") parser.add_argument('--new-instance', action='store_true', default=False, help="Run a new instance of Spyder, even if ...
[ "def", "get_options", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "usage", "=", "\"spyder [options] files\"", ")", "parser", ".", "add_argument", "(", "'--new-instance'", ",", "action", "=", "'store_true'", ",", "...
Convert options into commands return commands, message
[ "Convert", "options", "into", "commands", "return", "commands", "message" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/cli_options.py#L9-L70
train
spyder-ide/spyder
spyder/plugins/projects/api.py
BaseProject.set_recent_files
def set_recent_files(self, recent_files): """Set a list of files opened by the project.""" for recent_file in recent_files[:]: if not os.path.isfile(recent_file): recent_files.remove(recent_file) try: self.CONF[WORKSPACE].set('main', 'recent_files', ...
python
def set_recent_files(self, recent_files): """Set a list of files opened by the project.""" for recent_file in recent_files[:]: if not os.path.isfile(recent_file): recent_files.remove(recent_file) try: self.CONF[WORKSPACE].set('main', 'recent_files', ...
[ "def", "set_recent_files", "(", "self", ",", "recent_files", ")", ":", "for", "recent_file", "in", "recent_files", "[", ":", "]", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "recent_file", ")", ":", "recent_files", ".", "remove", "(", "recen...
Set a list of files opened by the project.
[ "Set", "a", "list", "of", "files", "opened", "by", "the", "project", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L68-L77
train
spyder-ide/spyder
spyder/plugins/projects/api.py
BaseProject.get_recent_files
def get_recent_files(self): """Return a list of files opened by the project.""" try: recent_files = self.CONF[WORKSPACE].get('main', 'recent_files', default=[]) except EnvironmentError: return [] for rec...
python
def get_recent_files(self): """Return a list of files opened by the project.""" try: recent_files = self.CONF[WORKSPACE].get('main', 'recent_files', default=[]) except EnvironmentError: return [] for rec...
[ "def", "get_recent_files", "(", "self", ")", ":", "try", ":", "recent_files", "=", "self", ".", "CONF", "[", "WORKSPACE", "]", ".", "get", "(", "'main'", ",", "'recent_files'", ",", "default", "=", "[", "]", ")", "except", "EnvironmentError", ":", "retur...
Return a list of files opened by the project.
[ "Return", "a", "list", "of", "files", "opened", "by", "the", "project", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L79-L90
train
spyder-ide/spyder
spyder/plugins/projects/api.py
BaseProject.set_root_path
def set_root_path(self, root_path): """Set project root path.""" if self.name is None: self.name = osp.basename(root_path) self.root_path = to_text_string(root_path) config_path = self.__get_project_config_path() if osp.exists(config_path): self.loa...
python
def set_root_path(self, root_path): """Set project root path.""" if self.name is None: self.name = osp.basename(root_path) self.root_path = to_text_string(root_path) config_path = self.__get_project_config_path() if osp.exists(config_path): self.loa...
[ "def", "set_root_path", "(", "self", ",", "root_path", ")", ":", "if", "self", ".", "name", "is", "None", ":", "self", ".", "name", "=", "osp", ".", "basename", "(", "root_path", ")", "self", ".", "root_path", "=", "to_text_string", "(", "root_path", "...
Set project root path.
[ "Set", "project", "root", "path", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L115-L126
train
spyder-ide/spyder
spyder/plugins/projects/api.py
BaseProject.rename
def rename(self, new_name): """Rename project and rename its root path accordingly.""" old_name = self.name self.name = new_name pypath = self.relative_pythonpath # ?? self.root_path = self.root_path[:-len(old_name)]+new_name self.relative_pythonpath = pypath # ??...
python
def rename(self, new_name): """Rename project and rename its root path accordingly.""" old_name = self.name self.name = new_name pypath = self.relative_pythonpath # ?? self.root_path = self.root_path[:-len(old_name)]+new_name self.relative_pythonpath = pypath # ??...
[ "def", "rename", "(", "self", ",", "new_name", ")", ":", "old_name", "=", "self", ".", "name", "self", ".", "name", "=", "new_name", "pypath", "=", "self", ".", "relative_pythonpath", "# ??\r", "self", ".", "root_path", "=", "self", ".", "root_path", "["...
Rename project and rename its root path accordingly.
[ "Rename", "project", "and", "rename", "its", "root", "path", "accordingly", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L128-L135
train
spyder-ide/spyder
spyder/plugins/onlinehelp/widgets.py
PydocBrowser.initialize
def initialize(self): """Start pydoc server""" QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QApplication.processEvents() self.start_server()
python
def initialize(self): """Start pydoc server""" QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QApplication.processEvents() self.start_server()
[ "def", "initialize", "(", "self", ")", ":", "QApplication", ".", "setOverrideCursor", "(", "QCursor", "(", "Qt", ".", "WaitCursor", ")", ")", "QApplication", ".", "processEvents", "(", ")", "self", ".", "start_server", "(", ")" ]
Start pydoc server
[ "Start", "pydoc", "server" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/widgets.py#L80-L84
train
spyder-ide/spyder
spyder/plugins/onlinehelp/widgets.py
PydocBrowser.start_server
def start_server(self): """Start pydoc server""" if self.server is None: self.port = select_port(default_port=self.DEFAULT_PORT) self.set_home_url('http://localhost:%d/' % self.port) elif self.server.isRunning(): self.server.server_started.disconnect(sel...
python
def start_server(self): """Start pydoc server""" if self.server is None: self.port = select_port(default_port=self.DEFAULT_PORT) self.set_home_url('http://localhost:%d/' % self.port) elif self.server.isRunning(): self.server.server_started.disconnect(sel...
[ "def", "start_server", "(", "self", ")", ":", "if", "self", ".", "server", "is", "None", ":", "self", ".", "port", "=", "select_port", "(", "default_port", "=", "self", ".", "DEFAULT_PORT", ")", "self", ".", "set_home_url", "(", "'http://localhost:%d/'", "...
Start pydoc server
[ "Start", "pydoc", "server" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/widgets.py#L104-L114
train
spyder-ide/spyder
spyder/plugins/onlinehelp/widgets.py
PydocBrowser.text_to_url
def text_to_url(self, text): """Convert text address into QUrl object""" if text.startswith('/'): text = text[1:] return QUrl(self.home_url.toString()+text+'.html')
python
def text_to_url(self, text): """Convert text address into QUrl object""" if text.startswith('/'): text = text[1:] return QUrl(self.home_url.toString()+text+'.html')
[ "def", "text_to_url", "(", "self", ",", "text", ")", ":", "if", "text", ".", "startswith", "(", "'/'", ")", ":", "text", "=", "text", "[", "1", ":", "]", "return", "QUrl", "(", "self", ".", "home_url", ".", "toString", "(", ")", "+", "text", "+",...
Convert text address into QUrl object
[ "Convert", "text", "address", "into", "QUrl", "object" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/widgets.py#L126-L130
train
spyder-ide/spyder
spyder/plugins/editor/utils/autosave.py
AutosaveForPlugin.do_autosave
def do_autosave(self): """Instruct current editorstack to autosave files where necessary.""" logger.debug('Autosave triggered') stack = self.editor.get_current_editorstack() stack.autosave.autosave_all() self.start_autosave_timer()
python
def do_autosave(self): """Instruct current editorstack to autosave files where necessary.""" logger.debug('Autosave triggered') stack = self.editor.get_current_editorstack() stack.autosave.autosave_all() self.start_autosave_timer()
[ "def", "do_autosave", "(", "self", ")", ":", "logger", ".", "debug", "(", "'Autosave triggered'", ")", "stack", "=", "self", ".", "editor", ".", "get_current_editorstack", "(", ")", "stack", ".", "autosave", ".", "autosave_all", "(", ")", "self", ".", "sta...
Instruct current editorstack to autosave files where necessary.
[ "Instruct", "current", "editorstack", "to", "autosave", "files", "where", "necessary", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L99-L104
train
spyder-ide/spyder
spyder/plugins/editor/utils/autosave.py
AutosaveForPlugin.try_recover_from_autosave
def try_recover_from_autosave(self): """Offer to recover files from autosave.""" autosave_dir = get_conf_path('autosave') autosave_mapping = CONF.get('editor', 'autosave_mapping', {}) dialog = RecoveryDialog(autosave_dir, autosave_mapping, parent=self.edit...
python
def try_recover_from_autosave(self): """Offer to recover files from autosave.""" autosave_dir = get_conf_path('autosave') autosave_mapping = CONF.get('editor', 'autosave_mapping', {}) dialog = RecoveryDialog(autosave_dir, autosave_mapping, parent=self.edit...
[ "def", "try_recover_from_autosave", "(", "self", ")", ":", "autosave_dir", "=", "get_conf_path", "(", "'autosave'", ")", "autosave_mapping", "=", "CONF", ".", "get", "(", "'editor'", ",", "'autosave_mapping'", ",", "{", "}", ")", "dialog", "=", "RecoveryDialog",...
Offer to recover files from autosave.
[ "Offer", "to", "recover", "files", "from", "autosave", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L106-L113
train
spyder-ide/spyder
spyder/plugins/editor/utils/autosave.py
AutosaveForStack.create_unique_autosave_filename
def create_unique_autosave_filename(self, filename, autosave_dir): """ Create unique autosave file name for specified file name. Args: filename (str): original file name autosave_dir (str): directory in which autosave files are stored """ basename = osp.b...
python
def create_unique_autosave_filename(self, filename, autosave_dir): """ Create unique autosave file name for specified file name. Args: filename (str): original file name autosave_dir (str): directory in which autosave files are stored """ basename = osp.b...
[ "def", "create_unique_autosave_filename", "(", "self", ",", "filename", ",", "autosave_dir", ")", ":", "basename", "=", "osp", ".", "basename", "(", "filename", ")", "autosave_filename", "=", "osp", ".", "join", "(", "autosave_dir", ",", "basename", ")", "if",...
Create unique autosave file name for specified file name. Args: filename (str): original file name autosave_dir (str): directory in which autosave files are stored
[ "Create", "unique", "autosave", "file", "name", "for", "specified", "file", "name", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L135-L152
train