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/plugins/plots/widgets/figurebrowser.py
FigureThumbnail.setup_gui
def setup_gui(self): """Setup the main layout of the widget.""" layout = QGridLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.canvas, 0, 1) layout.addLayout(self.setup_toolbar(), 0, 3, 2, 1) layout.setColumnStretch(0, 100) layout.setColum...
python
def setup_gui(self): """Setup the main layout of the widget.""" layout = QGridLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.canvas, 0, 1) layout.addLayout(self.setup_toolbar(), 0, 3, 2, 1) layout.setColumnStretch(0, 100) layout.setColum...
[ "def", "setup_gui", "(", "self", ")", ":", "layout", "=", "QGridLayout", "(", "self", ")", "layout", ".", "setContentsMargins", "(", "0", ",", "0", ",", "0", ",", "0", ")", "layout", ".", "addWidget", "(", "self", ".", "canvas", ",", "0", ",", "1",...
Setup the main layout of the widget.
[ "Setup", "the", "main", "layout", "of", "the", "widget", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L767-L776
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureThumbnail.setup_toolbar
def setup_toolbar(self): """Setup the toolbar.""" self.savefig_btn = create_toolbutton( self, icon=ima.icon('filesave'), tip=_("Save Image As..."), triggered=self.emit_save_figure) self.delfig_btn = create_toolbutton( self, icon=ima.icon('editclear...
python
def setup_toolbar(self): """Setup the toolbar.""" self.savefig_btn = create_toolbutton( self, icon=ima.icon('filesave'), tip=_("Save Image As..."), triggered=self.emit_save_figure) self.delfig_btn = create_toolbutton( self, icon=ima.icon('editclear...
[ "def", "setup_toolbar", "(", "self", ")", ":", "self", ".", "savefig_btn", "=", "create_toolbutton", "(", "self", ",", "icon", "=", "ima", ".", "icon", "(", "'filesave'", ")", ",", "tip", "=", "_", "(", "\"Save Image As...\"", ")", ",", "triggered", "=",...
Setup the toolbar.
[ "Setup", "the", "toolbar", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L778-L796
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureThumbnail.highlight_canvas
def highlight_canvas(self, highlight): """ Set a colored frame around the FigureCanvas if highlight is True. """ colorname = self.canvas.palette().highlight().color().name() if highlight: self.canvas.setStyleSheet( "FigureCanvas{border: 1px solid %...
python
def highlight_canvas(self, highlight): """ Set a colored frame around the FigureCanvas if highlight is True. """ colorname = self.canvas.palette().highlight().color().name() if highlight: self.canvas.setStyleSheet( "FigureCanvas{border: 1px solid %...
[ "def", "highlight_canvas", "(", "self", ",", "highlight", ")", ":", "colorname", "=", "self", ".", "canvas", ".", "palette", "(", ")", ".", "highlight", "(", ")", ".", "color", "(", ")", ".", "name", "(", ")", "if", "highlight", ":", "self", ".", "...
Set a colored frame around the FigureCanvas if highlight is True.
[ "Set", "a", "colored", "frame", "around", "the", "FigureCanvas", "if", "highlight", "is", "True", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L798-L807
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureThumbnail.eventFilter
def eventFilter(self, widget, event): """ A filter that is used to send a signal when the figure canvas is clicked. """ if event.type() == QEvent.MouseButtonPress: if event.button() == Qt.LeftButton: self.sig_canvas_clicked.emit(self) return su...
python
def eventFilter(self, widget, event): """ A filter that is used to send a signal when the figure canvas is clicked. """ if event.type() == QEvent.MouseButtonPress: if event.button() == Qt.LeftButton: self.sig_canvas_clicked.emit(self) return su...
[ "def", "eventFilter", "(", "self", ",", "widget", ",", "event", ")", ":", "if", "event", ".", "type", "(", ")", "==", "QEvent", ".", "MouseButtonPress", ":", "if", "event", ".", "button", "(", ")", "==", "Qt", ".", "LeftButton", ":", "self", ".", "...
A filter that is used to send a signal when the figure canvas is clicked.
[ "A", "filter", "that", "is", "used", "to", "send", "a", "signal", "when", "the", "figure", "canvas", "is", "clicked", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L809-L817
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureThumbnail.emit_save_figure
def emit_save_figure(self): """ Emit a signal when the toolbutton to save the figure is clicked. """ self.sig_save_figure.emit(self.canvas.fig, self.canvas.fmt)
python
def emit_save_figure(self): """ Emit a signal when the toolbutton to save the figure is clicked. """ self.sig_save_figure.emit(self.canvas.fig, self.canvas.fmt)
[ "def", "emit_save_figure", "(", "self", ")", ":", "self", ".", "sig_save_figure", ".", "emit", "(", "self", ".", "canvas", ".", "fig", ",", "self", ".", "canvas", ".", "fmt", ")" ]
Emit a signal when the toolbutton to save the figure is clicked.
[ "Emit", "a", "signal", "when", "the", "toolbutton", "to", "save", "the", "figure", "is", "clicked", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L819-L823
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureCanvas.context_menu_requested
def context_menu_requested(self, event): """Popup context menu.""" if self.fig: pos = QPoint(event.x(), event.y()) context_menu = QMenu(self) context_menu.addAction(ima.icon('editcopy'), "Copy Image", self.copy_figure, ...
python
def context_menu_requested(self, event): """Popup context menu.""" if self.fig: pos = QPoint(event.x(), event.y()) context_menu = QMenu(self) context_menu.addAction(ima.icon('editcopy'), "Copy Image", self.copy_figure, ...
[ "def", "context_menu_requested", "(", "self", ",", "event", ")", ":", "if", "self", ".", "fig", ":", "pos", "=", "QPoint", "(", "event", ".", "x", "(", ")", ",", "event", ".", "y", "(", ")", ")", "context_menu", "=", "QMenu", "(", "self", ")", "c...
Popup context menu.
[ "Popup", "context", "menu", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L853-L862
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureCanvas.copy_figure
def copy_figure(self): """Copy figure to clipboard.""" if self.fmt in ['image/png', 'image/jpeg']: qpixmap = QPixmap() qpixmap.loadFromData(self.fig, self.fmt.upper()) QApplication.clipboard().setImage(qpixmap.toImage()) elif self.fmt == 'image/svg+xml': ...
python
def copy_figure(self): """Copy figure to clipboard.""" if self.fmt in ['image/png', 'image/jpeg']: qpixmap = QPixmap() qpixmap.loadFromData(self.fig, self.fmt.upper()) QApplication.clipboard().setImage(qpixmap.toImage()) elif self.fmt == 'image/svg+xml': ...
[ "def", "copy_figure", "(", "self", ")", ":", "if", "self", ".", "fmt", "in", "[", "'image/png'", ",", "'image/jpeg'", "]", ":", "qpixmap", "=", "QPixmap", "(", ")", "qpixmap", ".", "loadFromData", "(", "self", ".", "fig", ",", "self", ".", "fmt", "."...
Copy figure to clipboard.
[ "Copy", "figure", "to", "clipboard", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L865-L876
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureCanvas.blink_figure
def blink_figure(self): """Blink figure once.""" if self.fig: self._blink_flag = not self._blink_flag self.repaint() if self._blink_flag: timer = QTimer() timer.singleShot(40, self.blink_figure)
python
def blink_figure(self): """Blink figure once.""" if self.fig: self._blink_flag = not self._blink_flag self.repaint() if self._blink_flag: timer = QTimer() timer.singleShot(40, self.blink_figure)
[ "def", "blink_figure", "(", "self", ")", ":", "if", "self", ".", "fig", ":", "self", ".", "_blink_flag", "=", "not", "self", ".", "_blink_flag", "self", ".", "repaint", "(", ")", "if", "self", ".", "_blink_flag", ":", "timer", "=", "QTimer", "(", ")"...
Blink figure once.
[ "Blink", "figure", "once", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L878-L885
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureCanvas.clear_canvas
def clear_canvas(self): """Clear the figure that was painted on the widget.""" self.fig = None self.fmt = None self._qpix_buffer = [] self.repaint()
python
def clear_canvas(self): """Clear the figure that was painted on the widget.""" self.fig = None self.fmt = None self._qpix_buffer = [] self.repaint()
[ "def", "clear_canvas", "(", "self", ")", ":", "self", ".", "fig", "=", "None", "self", ".", "fmt", "=", "None", "self", ".", "_qpix_buffer", "=", "[", "]", "self", ".", "repaint", "(", ")" ]
Clear the figure that was painted on the widget.
[ "Clear", "the", "figure", "that", "was", "painted", "on", "the", "widget", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L887-L892
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureCanvas.load_figure
def load_figure(self, fig, fmt): """ Load the figure from a png, jpg, or svg image, convert it in a QPixmap, and force a repaint of the widget. """ self.fig = fig self.fmt = fmt if fmt in ['image/png', 'image/jpeg']: self._qpix_orig = QPixmap() ...
python
def load_figure(self, fig, fmt): """ Load the figure from a png, jpg, or svg image, convert it in a QPixmap, and force a repaint of the widget. """ self.fig = fig self.fmt = fmt if fmt in ['image/png', 'image/jpeg']: self._qpix_orig = QPixmap() ...
[ "def", "load_figure", "(", "self", ",", "fig", ",", "fmt", ")", ":", "self", ".", "fig", "=", "fig", "self", ".", "fmt", "=", "fmt", "if", "fmt", "in", "[", "'image/png'", ",", "'image/jpeg'", "]", ":", "self", ".", "_qpix_orig", "=", "QPixmap", "(...
Load the figure from a png, jpg, or svg image, convert it in a QPixmap, and force a repaint of the widget.
[ "Load", "the", "figure", "from", "a", "png", "jpg", "or", "svg", "image", "convert", "it", "in", "a", "QPixmap", "and", "force", "a", "repaint", "of", "the", "widget", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L894-L910
train
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureCanvas.paintEvent
def paintEvent(self, event): """Qt method override to paint a custom image on the Widget.""" super(FigureCanvas, self).paintEvent(event) # Prepare the rect on which the image is going to be painted : fw = self.frameWidth() rect = QRect(0 + fw, 0 + fw, self.si...
python
def paintEvent(self, event): """Qt method override to paint a custom image on the Widget.""" super(FigureCanvas, self).paintEvent(event) # Prepare the rect on which the image is going to be painted : fw = self.frameWidth() rect = QRect(0 + fw, 0 + fw, self.si...
[ "def", "paintEvent", "(", "self", ",", "event", ")", ":", "super", "(", "FigureCanvas", ",", "self", ")", ".", "paintEvent", "(", "event", ")", "# Prepare the rect on which the image is going to be painted :", "fw", "=", "self", ".", "frameWidth", "(", ")", "rec...
Qt method override to paint a custom image on the Widget.
[ "Qt", "method", "override", "to", "paint", "a", "custom", "image", "on", "the", "Widget", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L912-L943
train
spyder-ide/spyder
spyder/preferences/maininterpreter.py
MainInterpreterConfigPage.python_executable_changed
def python_executable_changed(self, pyexec): """Custom Python executable value has been changed""" if not self.cus_exec_radio.isChecked(): return False def_pyexec = get_python_executable() if not is_text_string(pyexec): pyexec = to_text_string(pyexec.toUtf8(...
python
def python_executable_changed(self, pyexec): """Custom Python executable value has been changed""" if not self.cus_exec_radio.isChecked(): return False def_pyexec = get_python_executable() if not is_text_string(pyexec): pyexec = to_text_string(pyexec.toUtf8(...
[ "def", "python_executable_changed", "(", "self", ",", "pyexec", ")", ":", "if", "not", "self", ".", "cus_exec_radio", ".", "isChecked", "(", ")", ":", "return", "False", "def_pyexec", "=", "get_python_executable", "(", ")", "if", "not", "is_text_string", "(", ...
Custom Python executable value has been changed
[ "Custom", "Python", "executable", "value", "has", "been", "changed" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L151-L168
train
spyder-ide/spyder
spyder/preferences/maininterpreter.py
MainInterpreterConfigPage.set_umr_namelist
def set_umr_namelist(self): """Set UMR excluded modules name list""" arguments, valid = QInputDialog.getText(self, _('UMR'), _("Set the list of excluded modules as " "this: <i>numpy, scipy</i>"), ...
python
def set_umr_namelist(self): """Set UMR excluded modules name list""" arguments, valid = QInputDialog.getText(self, _('UMR'), _("Set the list of excluded modules as " "this: <i>numpy, scipy</i>"), ...
[ "def", "set_umr_namelist", "(", "self", ")", ":", "arguments", ",", "valid", "=", "QInputDialog", ".", "getText", "(", "self", ",", "_", "(", "'UMR'", ")", ",", "_", "(", "\"Set the list of excluded modules as \"", "\"this: <i>numpy, scipy</i>\"", ")", ",", "QLi...
Set UMR excluded modules name list
[ "Set", "UMR", "excluded", "modules", "name", "list" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L193-L232
train
spyder-ide/spyder
spyder/preferences/maininterpreter.py
MainInterpreterConfigPage.set_custom_interpreters_list
def set_custom_interpreters_list(self, value): """Update the list of interpreters used and the current one.""" custom_list = self.get_option('custom_interpreters_list') if value not in custom_list and value != get_python_executable(): custom_list.append(value) self.s...
python
def set_custom_interpreters_list(self, value): """Update the list of interpreters used and the current one.""" custom_list = self.get_option('custom_interpreters_list') if value not in custom_list and value != get_python_executable(): custom_list.append(value) self.s...
[ "def", "set_custom_interpreters_list", "(", "self", ",", "value", ")", ":", "custom_list", "=", "self", ".", "get_option", "(", "'custom_interpreters_list'", ")", "if", "value", "not", "in", "custom_list", "and", "value", "!=", "get_python_executable", "(", ")", ...
Update the list of interpreters used and the current one.
[ "Update", "the", "list", "of", "interpreters", "used", "and", "the", "current", "one", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L234-L239
train
spyder-ide/spyder
spyder/preferences/maininterpreter.py
MainInterpreterConfigPage.validate_custom_interpreters_list
def validate_custom_interpreters_list(self): """Check that the used custom interpreters are still valid.""" custom_list = self.get_option('custom_interpreters_list') valid_custom_list = [] for value in custom_list: if (osp.isfile(value) and programs.is_python_interpreter...
python
def validate_custom_interpreters_list(self): """Check that the used custom interpreters are still valid.""" custom_list = self.get_option('custom_interpreters_list') valid_custom_list = [] for value in custom_list: if (osp.isfile(value) and programs.is_python_interpreter...
[ "def", "validate_custom_interpreters_list", "(", "self", ")", ":", "custom_list", "=", "self", ".", "get_option", "(", "'custom_interpreters_list'", ")", "valid_custom_list", "=", "[", "]", "for", "value", "in", "custom_list", ":", "if", "(", "osp", ".", "isfile...
Check that the used custom interpreters are still valid.
[ "Check", "that", "the", "used", "custom", "interpreters", "are", "still", "valid", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L241-L249
train
spyder-ide/spyder
spyder/api/panel.py
Panel.on_install
def on_install(self, editor): """ Extends :meth:`spyder.api.EditorExtension.on_install` method to set the editor instance as the parent widget. .. warning:: Don't forget to call **super** if you override this method! :param editor: editor instance :type edit...
python
def on_install(self, editor): """ Extends :meth:`spyder.api.EditorExtension.on_install` method to set the editor instance as the parent widget. .. warning:: Don't forget to call **super** if you override this method! :param editor: editor instance :type edit...
[ "def", "on_install", "(", "self", ",", "editor", ")", ":", "EditorExtension", ".", "on_install", "(", "self", ",", "editor", ")", "self", ".", "setParent", "(", "editor", ")", "self", ".", "setPalette", "(", "QApplication", ".", "instance", "(", ")", "."...
Extends :meth:`spyder.api.EditorExtension.on_install` method to set the editor instance as the parent widget. .. warning:: Don't forget to call **super** if you override this method! :param editor: editor instance :type editor: spyder.plugins.editor.widgets.codeeditor.CodeE...
[ "Extends", ":", "meth", ":", "spyder", ".", "api", ".", "EditorExtension", ".", "on_install", "method", "to", "set", "the", "editor", "instance", "as", "the", "parent", "widget", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L92-L114
train
spyder-ide/spyder
spyder/api/panel.py
Panel.paintEvent
def paintEvent(self, event): """Fills the panel background using QPalette.""" if self.isVisible() and self.position != self.Position.FLOATING: # fill background self._background_brush = QBrush(QColor( self.editor.sideareas_color)) self._foreground_pen ...
python
def paintEvent(self, event): """Fills the panel background using QPalette.""" if self.isVisible() and self.position != self.Position.FLOATING: # fill background self._background_brush = QBrush(QColor( self.editor.sideareas_color)) self._foreground_pen ...
[ "def", "paintEvent", "(", "self", ",", "event", ")", ":", "if", "self", ".", "isVisible", "(", ")", "and", "self", ".", "position", "!=", "self", ".", "Position", ".", "FLOATING", ":", "# fill background", "self", ".", "_background_brush", "=", "QBrush", ...
Fills the panel background using QPalette.
[ "Fills", "the", "panel", "background", "using", "QPalette", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L116-L125
train
spyder-ide/spyder
spyder/api/panel.py
Panel.setVisible
def setVisible(self, visible): """ Shows/Hides the panel. Automatically call PanelsManager.refresh_panels. :param visible: Visible state """ logger.debug('%s visibility changed', self.name) super(Panel, self).setVisible(visible) if self.editor: ...
python
def setVisible(self, visible): """ Shows/Hides the panel. Automatically call PanelsManager.refresh_panels. :param visible: Visible state """ logger.debug('%s visibility changed', self.name) super(Panel, self).setVisible(visible) if self.editor: ...
[ "def", "setVisible", "(", "self", ",", "visible", ")", ":", "logger", ".", "debug", "(", "'%s visibility changed'", ",", "self", ".", "name", ")", "super", "(", "Panel", ",", "self", ")", ".", "setVisible", "(", "visible", ")", "if", "self", ".", "edit...
Shows/Hides the panel. Automatically call PanelsManager.refresh_panels. :param visible: Visible state
[ "Shows", "/", "Hides", "the", "panel", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L127-L138
train
spyder-ide/spyder
spyder/api/panel.py
Panel.set_geometry
def set_geometry(self, crect): """Set geometry for floating panels. Normally you don't need to override this method, you should override `geometry` instead. """ x0, y0, width, height = self.geometry() if width is None: width = crect.width() if height...
python
def set_geometry(self, crect): """Set geometry for floating panels. Normally you don't need to override this method, you should override `geometry` instead. """ x0, y0, width, height = self.geometry() if width is None: width = crect.width() if height...
[ "def", "set_geometry", "(", "self", ",", "crect", ")", ":", "x0", ",", "y0", ",", "width", ",", "height", "=", "self", ".", "geometry", "(", ")", "if", "width", "is", "None", ":", "width", "=", "crect", ".", "width", "(", ")", "if", "height", "is...
Set geometry for floating panels. Normally you don't need to override this method, you should override `geometry` instead.
[ "Set", "geometry", "for", "floating", "panels", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L149-L170
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/utils/ssh.py
openssh_tunnel
def openssh_tunnel(self, lport, rport, server, remoteip='127.0.0.1', keyfile=None, password=None, timeout=0.4): """ We decided to replace pyzmq's openssh_tunnel method to work around issue https://github.com/zeromq/pyzmq/issues/589 which was solved in pyzmq https://github.com/zeromq/p...
python
def openssh_tunnel(self, lport, rport, server, remoteip='127.0.0.1', keyfile=None, password=None, timeout=0.4): """ We decided to replace pyzmq's openssh_tunnel method to work around issue https://github.com/zeromq/pyzmq/issues/589 which was solved in pyzmq https://github.com/zeromq/p...
[ "def", "openssh_tunnel", "(", "self", ",", "lport", ",", "rport", ",", "server", ",", "remoteip", "=", "'127.0.0.1'", ",", "keyfile", "=", "None", ",", "password", "=", "None", ",", "timeout", "=", "0.4", ")", ":", "ssh", "=", "\"ssh \"", "if", "keyfil...
We decided to replace pyzmq's openssh_tunnel method to work around issue https://github.com/zeromq/pyzmq/issues/589 which was solved in pyzmq https://github.com/zeromq/pyzmq/pull/615
[ "We", "decided", "to", "replace", "pyzmq", "s", "openssh_tunnel", "method", "to", "work", "around", "issue", "https", ":", "//", "github", ".", "com", "/", "zeromq", "/", "pyzmq", "/", "issues", "/", "589", "which", "was", "solved", "in", "pyzmq", "https...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/utils/ssh.py#L23-L98
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget.configure_namespacebrowser
def configure_namespacebrowser(self): """Configure associated namespace browser widget""" # Update namespace view self.sig_namespace_view.connect(lambda data: self.namespacebrowser.process_remote_view(data)) # Update properties of variables self.sig_var_properties.co...
python
def configure_namespacebrowser(self): """Configure associated namespace browser widget""" # Update namespace view self.sig_namespace_view.connect(lambda data: self.namespacebrowser.process_remote_view(data)) # Update properties of variables self.sig_var_properties.co...
[ "def", "configure_namespacebrowser", "(", "self", ")", ":", "# Update namespace view", "self", ".", "sig_namespace_view", ".", "connect", "(", "lambda", "data", ":", "self", ".", "namespacebrowser", ".", "process_remote_view", "(", "data", ")", ")", "# Update proper...
Configure associated namespace browser widget
[ "Configure", "associated", "namespace", "browser", "widget" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L55-L63
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget.set_namespace_view_settings
def set_namespace_view_settings(self): """Set the namespace view settings""" if self.namespacebrowser: settings = to_text_string( self.namespacebrowser.get_view_settings()) code =(u"get_ipython().kernel.namespace_view_settings = %s" % settings) ...
python
def set_namespace_view_settings(self): """Set the namespace view settings""" if self.namespacebrowser: settings = to_text_string( self.namespacebrowser.get_view_settings()) code =(u"get_ipython().kernel.namespace_view_settings = %s" % settings) ...
[ "def", "set_namespace_view_settings", "(", "self", ")", ":", "if", "self", ".", "namespacebrowser", ":", "settings", "=", "to_text_string", "(", "self", ".", "namespacebrowser", ".", "get_view_settings", "(", ")", ")", "code", "=", "(", "u\"get_ipython().kernel.na...
Set the namespace view settings
[ "Set", "the", "namespace", "view", "settings" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L73-L80
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget.get_value
def get_value(self, name): """Ask kernel for a value""" code = u"get_ipython().kernel.get_value('%s')" % name if self._reading: method = self.kernel_client.input code = u'!' + code else: method = self.silent_execute # Wait until the kernel ret...
python
def get_value(self, name): """Ask kernel for a value""" code = u"get_ipython().kernel.get_value('%s')" % name if self._reading: method = self.kernel_client.input code = u'!' + code else: method = self.silent_execute # Wait until the kernel ret...
[ "def", "get_value", "(", "self", ",", "name", ")", ":", "code", "=", "u\"get_ipython().kernel.get_value('%s')\"", "%", "name", "if", "self", ".", "_reading", ":", "method", "=", "self", ".", "kernel_client", ".", "input", "code", "=", "u'!'", "+", "code", ...
Ask kernel for a value
[ "Ask", "kernel", "for", "a", "value" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L82-L108
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget.set_value
def set_value(self, name, value): """Set value for a variable""" value = to_text_string(value) code = u"get_ipython().kernel.set_value('%s', %s, %s)" % (name, value, PY2) if self._reading: self.kernel_client.i...
python
def set_value(self, name, value): """Set value for a variable""" value = to_text_string(value) code = u"get_ipython().kernel.set_value('%s', %s, %s)" % (name, value, PY2) if self._reading: self.kernel_client.i...
[ "def", "set_value", "(", "self", ",", "name", ",", "value", ")", ":", "value", "=", "to_text_string", "(", "value", ")", "code", "=", "u\"get_ipython().kernel.set_value('%s', %s, %s)\"", "%", "(", "name", ",", "value", ",", "PY2", ")", "if", "self", ".", "...
Set value for a variable
[ "Set", "value", "for", "a", "variable" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L110-L119
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget.remove_value
def remove_value(self, name): """Remove a variable""" code = u"get_ipython().kernel.remove_value('%s')" % name if self._reading: self.kernel_client.input(u'!' + code) else: self.silent_execute(code)
python
def remove_value(self, name): """Remove a variable""" code = u"get_ipython().kernel.remove_value('%s')" % name if self._reading: self.kernel_client.input(u'!' + code) else: self.silent_execute(code)
[ "def", "remove_value", "(", "self", ",", "name", ")", ":", "code", "=", "u\"get_ipython().kernel.remove_value('%s')\"", "%", "name", "if", "self", ".", "_reading", ":", "self", ".", "kernel_client", ".", "input", "(", "u'!'", "+", "code", ")", "else", ":", ...
Remove a variable
[ "Remove", "a", "variable" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L121-L127
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget.copy_value
def copy_value(self, orig_name, new_name): """Copy a variable""" code = u"get_ipython().kernel.copy_value('%s', '%s')" % (orig_name, new_name) if self._reading: self.kernel_client.input(u'!' + code) else: ...
python
def copy_value(self, orig_name, new_name): """Copy a variable""" code = u"get_ipython().kernel.copy_value('%s', '%s')" % (orig_name, new_name) if self._reading: self.kernel_client.input(u'!' + code) else: ...
[ "def", "copy_value", "(", "self", ",", "orig_name", ",", "new_name", ")", ":", "code", "=", "u\"get_ipython().kernel.copy_value('%s', '%s')\"", "%", "(", "orig_name", ",", "new_name", ")", "if", "self", ".", "_reading", ":", "self", ".", "kernel_client", ".", ...
Copy a variable
[ "Copy", "a", "variable" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L129-L136
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget._handle_spyder_msg
def _handle_spyder_msg(self, msg): """ Handle internal spyder messages """ spyder_msg_type = msg['content'].get('spyder_msg_type') if spyder_msg_type == 'data': # Deserialize data try: if PY2: value = cloudpickle.loads(m...
python
def _handle_spyder_msg(self, msg): """ Handle internal spyder messages """ spyder_msg_type = msg['content'].get('spyder_msg_type') if spyder_msg_type == 'data': # Deserialize data try: if PY2: value = cloudpickle.loads(m...
[ "def", "_handle_spyder_msg", "(", "self", ",", "msg", ")", ":", "spyder_msg_type", "=", "msg", "[", "'content'", "]", ".", "get", "(", "'spyder_msg_type'", ")", "if", "spyder_msg_type", "==", "'data'", ":", "# Deserialize data", "try", ":", "if", "PY2", ":",...
Handle internal spyder messages
[ "Handle", "internal", "spyder", "messages" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L176-L206
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget._handle_execute_reply
def _handle_execute_reply(self, msg): """ Reimplemented to handle communications between Spyder and the kernel """ msg_id = msg['parent_header']['msg_id'] info = self._request_info['execute'].get(msg_id) # unset reading flag, because if execute finished, raw_input...
python
def _handle_execute_reply(self, msg): """ Reimplemented to handle communications between Spyder and the kernel """ msg_id = msg['parent_header']['msg_id'] info = self._request_info['execute'].get(msg_id) # unset reading flag, because if execute finished, raw_input...
[ "def", "_handle_execute_reply", "(", "self", ",", "msg", ")", ":", "msg_id", "=", "msg", "[", "'parent_header'", "]", "[", "'msg_id'", "]", "info", "=", "self", ".", "_request_info", "[", "'execute'", "]", ".", "get", "(", "msg_id", ")", "# unset reading f...
Reimplemented to handle communications between Spyder and the kernel
[ "Reimplemented", "to", "handle", "communications", "between", "Spyder", "and", "the", "kernel" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L209-L234
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
NamepaceBrowserWidget._handle_status
def _handle_status(self, msg): """ Reimplemented to refresh the namespacebrowser after kernel restarts """ state = msg['content'].get('execution_state', '') msg_type = msg['parent_header'].get('msg_type', '') if state == 'starting': # This is needed to...
python
def _handle_status(self, msg): """ Reimplemented to refresh the namespacebrowser after kernel restarts """ state = msg['content'].get('execution_state', '') msg_type = msg['parent_header'].get('msg_type', '') if state == 'starting': # This is needed to...
[ "def", "_handle_status", "(", "self", ",", "msg", ")", ":", "state", "=", "msg", "[", "'content'", "]", ".", "get", "(", "'execution_state'", ",", "''", ")", "msg_type", "=", "msg", "[", "'parent_header'", "]", ".", "get", "(", "'msg_type'", ",", "''",...
Reimplemented to refresh the namespacebrowser after kernel restarts
[ "Reimplemented", "to", "refresh", "the", "namespacebrowser", "after", "kernel", "restarts" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L236-L261
train
spyder-ide/spyder
spyder/plugins/base.py
PluginWindow.closeEvent
def closeEvent(self, event): """Reimplement Qt method.""" self.plugin.dockwidget.setWidget(self.plugin) self.plugin.dockwidget.setVisible(True) self.plugin.switch_to_plugin() QMainWindow.closeEvent(self, event) self.plugin.undocked_window = None
python
def closeEvent(self, event): """Reimplement Qt method.""" self.plugin.dockwidget.setWidget(self.plugin) self.plugin.dockwidget.setVisible(True) self.plugin.switch_to_plugin() QMainWindow.closeEvent(self, event) self.plugin.undocked_window = None
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "self", ".", "plugin", ".", "dockwidget", ".", "setWidget", "(", "self", ".", "plugin", ")", "self", ".", "plugin", ".", "dockwidget", ".", "setVisible", "(", "True", ")", "self", ".", "plugin",...
Reimplement Qt method.
[ "Reimplement", "Qt", "method", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L38-L44
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.initialize_plugin_in_mainwindow_layout
def initialize_plugin_in_mainwindow_layout(self): """ If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin """ if self.get_...
python
def initialize_plugin_in_mainwindow_layout(self): """ If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin """ if self.get_...
[ "def", "initialize_plugin_in_mainwindow_layout", "(", "self", ")", ":", "if", "self", ".", "get_option", "(", "'first_time'", ",", "True", ")", ":", "try", ":", "self", ".", "on_first_registration", "(", ")", "except", "NotImplementedError", ":", "return", "self...
If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin
[ "If", "this", "is", "the", "first", "time", "the", "plugin", "is", "shown", "perform", "actions", "to", "initialize", "plugin", "position", "in", "Spyder", "s", "window", "layout", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L76-L89
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.update_margins
def update_margins(self): """Update plugin margins""" layout = self.layout() if self.default_margins is None: self.default_margins = layout.getContentsMargins() if CONF.get('main', 'use_custom_margin'): margin = CONF.get('main', 'custom_margin') layout...
python
def update_margins(self): """Update plugin margins""" layout = self.layout() if self.default_margins is None: self.default_margins = layout.getContentsMargins() if CONF.get('main', 'use_custom_margin'): margin = CONF.get('main', 'custom_margin') layout...
[ "def", "update_margins", "(", "self", ")", ":", "layout", "=", "self", ".", "layout", "(", ")", "if", "self", ".", "default_margins", "is", "None", ":", "self", ".", "default_margins", "=", "layout", ".", "getContentsMargins", "(", ")", "if", "CONF", "."...
Update plugin margins
[ "Update", "plugin", "margins" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L91-L100
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.update_plugin_title
def update_plugin_title(self): """Update plugin title, i.e. dockwidget or window title""" if self.dockwidget is not None: win = self.dockwidget elif self.undocked_window is not None: win = self.undocked_window else: return win.setWindowTitle(se...
python
def update_plugin_title(self): """Update plugin title, i.e. dockwidget or window title""" if self.dockwidget is not None: win = self.dockwidget elif self.undocked_window is not None: win = self.undocked_window else: return win.setWindowTitle(se...
[ "def", "update_plugin_title", "(", "self", ")", ":", "if", "self", ".", "dockwidget", "is", "not", "None", ":", "win", "=", "self", ".", "dockwidget", "elif", "self", ".", "undocked_window", "is", "not", "None", ":", "win", "=", "self", ".", "undocked_wi...
Update plugin title, i.e. dockwidget or window title
[ "Update", "plugin", "title", "i", ".", "e", ".", "dockwidget", "or", "window", "title" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L102-L110
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.create_dockwidget
def create_dockwidget(self): """Add to parent QMainWindow as a dock widget""" # Creating dock widget dock = SpyderDockWidget(self.get_plugin_title(), self.main) # Set properties dock.setObjectName(self.__class__.__name__+"_dw") dock.setAllowedAreas(self.ALLOWED_AREAS) ...
python
def create_dockwidget(self): """Add to parent QMainWindow as a dock widget""" # Creating dock widget dock = SpyderDockWidget(self.get_plugin_title(), self.main) # Set properties dock.setObjectName(self.__class__.__name__+"_dw") dock.setAllowedAreas(self.ALLOWED_AREAS) ...
[ "def", "create_dockwidget", "(", "self", ")", ":", "# Creating dock widget", "dock", "=", "SpyderDockWidget", "(", "self", ".", "get_plugin_title", "(", ")", ",", "self", ".", "main", ")", "# Set properties", "dock", ".", "setObjectName", "(", "self", ".", "__...
Add to parent QMainWindow as a dock widget
[ "Add", "to", "parent", "QMainWindow", "as", "a", "dock", "widget" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L112-L131
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.create_configwidget
def create_configwidget(self, parent): """Create configuration dialog box page widget""" if self.CONFIGWIDGET_CLASS is not None: configwidget = self.CONFIGWIDGET_CLASS(self, parent) configwidget.initialize() return configwidget
python
def create_configwidget(self, parent): """Create configuration dialog box page widget""" if self.CONFIGWIDGET_CLASS is not None: configwidget = self.CONFIGWIDGET_CLASS(self, parent) configwidget.initialize() return configwidget
[ "def", "create_configwidget", "(", "self", ",", "parent", ")", ":", "if", "self", ".", "CONFIGWIDGET_CLASS", "is", "not", "None", ":", "configwidget", "=", "self", ".", "CONFIGWIDGET_CLASS", "(", "self", ",", "parent", ")", "configwidget", ".", "initialize", ...
Create configuration dialog box page widget
[ "Create", "configuration", "dialog", "box", "page", "widget" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L133-L138
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.get_plugin_font
def get_plugin_font(self, rich_text=False): """ Return plugin font option. All plugins in Spyder use a global font. This is a convenience method in case some plugins will have a delta size based on the default size. """ if rich_text: option = 'rich_font' ...
python
def get_plugin_font(self, rich_text=False): """ Return plugin font option. All plugins in Spyder use a global font. This is a convenience method in case some plugins will have a delta size based on the default size. """ if rich_text: option = 'rich_font' ...
[ "def", "get_plugin_font", "(", "self", ",", "rich_text", "=", "False", ")", ":", "if", "rich_text", ":", "option", "=", "'rich_font'", "font_size_delta", "=", "self", ".", "RICH_FONT_SIZE_DELTA", "else", ":", "option", "=", "'font'", "font_size_delta", "=", "s...
Return plugin font option. All plugins in Spyder use a global font. This is a convenience method in case some plugins will have a delta size based on the default size.
[ "Return", "plugin", "font", "option", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L155-L170
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.show_message
def show_message(self, message, timeout=0): """Show message in main window's status bar""" self.main.statusBar().showMessage(message, timeout)
python
def show_message(self, message, timeout=0): """Show message in main window's status bar""" self.main.statusBar().showMessage(message, timeout)
[ "def", "show_message", "(", "self", ",", "message", ",", "timeout", "=", "0", ")", ":", "self", ".", "main", ".", "statusBar", "(", ")", ".", "showMessage", "(", "message", ",", "timeout", ")" ]
Show message in main window's status bar
[ "Show", "message", "in", "main", "window", "s", "status", "bar" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L183-L185
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.create_toggle_view_action
def create_toggle_view_action(self): """Associate a toggle view action with each plugin""" title = self.get_plugin_title() if self.CONF_SECTION == 'editor': title = _('Editor') if self.shortcut is not None: action = create_action(self, title, ...
python
def create_toggle_view_action(self): """Associate a toggle view action with each plugin""" title = self.get_plugin_title() if self.CONF_SECTION == 'editor': title = _('Editor') if self.shortcut is not None: action = create_action(self, title, ...
[ "def", "create_toggle_view_action", "(", "self", ")", ":", "title", "=", "self", ".", "get_plugin_title", "(", ")", "if", "self", ".", "CONF_SECTION", "==", "'editor'", ":", "title", "=", "_", "(", "'Editor'", ")", "if", "self", ".", "shortcut", "is", "n...
Associate a toggle view action with each plugin
[ "Associate", "a", "toggle", "view", "action", "with", "each", "plugin" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L187-L200
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.toggle_view
def toggle_view(self, checked): """Toggle view""" if not self.dockwidget: return if checked: self.dockwidget.show() self.dockwidget.raise_() else: self.dockwidget.hide()
python
def toggle_view(self, checked): """Toggle view""" if not self.dockwidget: return if checked: self.dockwidget.show() self.dockwidget.raise_() else: self.dockwidget.hide()
[ "def", "toggle_view", "(", "self", ",", "checked", ")", ":", "if", "not", "self", ".", "dockwidget", ":", "return", "if", "checked", ":", "self", ".", "dockwidget", ".", "show", "(", ")", "self", ".", "dockwidget", ".", "raise_", "(", ")", "else", ":...
Toggle view
[ "Toggle", "view" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L202-L210
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.close_window
def close_window(self): """Close QMainWindow instance that contains this plugin.""" if self.undocked_window is not None: self.undocked_window.close() self.undocked_window = None # Oddly, these actions can appear disabled after the Dock # action is pressed...
python
def close_window(self): """Close QMainWindow instance that contains this plugin.""" if self.undocked_window is not None: self.undocked_window.close() self.undocked_window = None # Oddly, these actions can appear disabled after the Dock # action is pressed...
[ "def", "close_window", "(", "self", ")", ":", "if", "self", ".", "undocked_window", "is", "not", "None", ":", "self", ".", "undocked_window", ".", "close", "(", ")", "self", ".", "undocked_window", "=", "None", "# Oddly, these actions can appear disabled after the...
Close QMainWindow instance that contains this plugin.
[ "Close", "QMainWindow", "instance", "that", "contains", "this", "plugin", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L213-L222
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.create_window
def create_window(self): """Create a QMainWindow instance containing this plugin.""" self.undocked_window = window = PluginWindow(self) window.setAttribute(Qt.WA_DeleteOnClose) icon = self.get_plugin_icon() if is_text_string(icon): icon = self.get_icon(icon) w...
python
def create_window(self): """Create a QMainWindow instance containing this plugin.""" self.undocked_window = window = PluginWindow(self) window.setAttribute(Qt.WA_DeleteOnClose) icon = self.get_plugin_icon() if is_text_string(icon): icon = self.get_icon(icon) w...
[ "def", "create_window", "(", "self", ")", ":", "self", ".", "undocked_window", "=", "window", "=", "PluginWindow", "(", "self", ")", "window", ".", "setAttribute", "(", "Qt", ".", "WA_DeleteOnClose", ")", "icon", "=", "self", ".", "get_plugin_icon", "(", "...
Create a QMainWindow instance containing this plugin.
[ "Create", "a", "QMainWindow", "instance", "containing", "this", "plugin", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L225-L241
train
spyder-ide/spyder
spyder/plugins/base.py
BasePluginMixin.on_top_level_changed
def on_top_level_changed(self, top_level): """Actions to perform when a plugin is undocked to be moved.""" if top_level: self.undock_action.setDisabled(True) else: self.undock_action.setDisabled(False)
python
def on_top_level_changed(self, top_level): """Actions to perform when a plugin is undocked to be moved.""" if top_level: self.undock_action.setDisabled(True) else: self.undock_action.setDisabled(False)
[ "def", "on_top_level_changed", "(", "self", ",", "top_level", ")", ":", "if", "top_level", ":", "self", ".", "undock_action", ".", "setDisabled", "(", "True", ")", "else", ":", "self", ".", "undock_action", ".", "setDisabled", "(", "False", ")" ]
Actions to perform when a plugin is undocked to be moved.
[ "Actions", "to", "perform", "when", "a", "plugin", "is", "undocked", "to", "be", "moved", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L244-L249
train
spyder-ide/spyder
spyder/widgets/reporterror.py
DescriptionWidget.cut
def cut(self): """Cut text""" self.truncate_selection(self.header_end_pos) if self.has_selected_text(): CodeEditor.cut(self)
python
def cut(self): """Cut text""" self.truncate_selection(self.header_end_pos) if self.has_selected_text(): CodeEditor.cut(self)
[ "def", "cut", "(", "self", ")", ":", "self", ".", "truncate_selection", "(", "self", ".", "header_end_pos", ")", "if", "self", ".", "has_selected_text", "(", ")", ":", "CodeEditor", ".", "cut", "(", "self", ")" ]
Cut text
[ "Cut", "text" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L76-L80
train
spyder-ide/spyder
spyder/widgets/reporterror.py
DescriptionWidget.keyPressEvent
def keyPressEvent(self, event): """Reimplemented Qt Method to avoid removing the header.""" event, text, key, ctrl, shift = restore_keyevent(event) cursor_position = self.get_position('cursor') if cursor_position < self.header_end_pos: self.restrict_cursor_position(self.head...
python
def keyPressEvent(self, event): """Reimplemented Qt Method to avoid removing the header.""" event, text, key, ctrl, shift = restore_keyevent(event) cursor_position = self.get_position('cursor') if cursor_position < self.header_end_pos: self.restrict_cursor_position(self.head...
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "event", ",", "text", ",", "key", ",", "ctrl", ",", "shift", "=", "restore_keyevent", "(", "event", ")", "cursor_position", "=", "self", ".", "get_position", "(", "'cursor'", ")", "if", "cursor...
Reimplemented Qt Method to avoid removing the header.
[ "Reimplemented", "Qt", "Method", "to", "avoid", "removing", "the", "header", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L82-L104
train
spyder-ide/spyder
spyder/widgets/reporterror.py
SpyderErrorDialog._submit_to_github
def _submit_to_github(self): """Action to take when pressing the submit button.""" # Get reference to the main window if self.parent() is not None: if getattr(self.parent(), 'main', False): # This covers the case when the dialog is attached # to the in...
python
def _submit_to_github(self): """Action to take when pressing the submit button.""" # Get reference to the main window if self.parent() is not None: if getattr(self.parent(), 'main', False): # This covers the case when the dialog is attached # to the in...
[ "def", "_submit_to_github", "(", "self", ")", ":", "# Get reference to the main window", "if", "self", ".", "parent", "(", ")", "is", "not", "None", ":", "if", "getattr", "(", "self", ".", "parent", "(", ")", ",", "'main'", ",", "False", ")", ":", "# Thi...
Action to take when pressing the submit button.
[ "Action", "to", "take", "when", "pressing", "the", "submit", "button", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L250-L305
train
spyder-ide/spyder
spyder/widgets/reporterror.py
SpyderErrorDialog._show_details
def _show_details(self): """Show traceback on its own dialog""" if self.details.isVisible(): self.details.hide() self.details_btn.setText(_('Show details')) else: self.resize(570, 700) self.details.document().setPlainText('') self.detai...
python
def _show_details(self): """Show traceback on its own dialog""" if self.details.isVisible(): self.details.hide() self.details_btn.setText(_('Show details')) else: self.resize(570, 700) self.details.document().setPlainText('') self.detai...
[ "def", "_show_details", "(", "self", ")", ":", "if", "self", ".", "details", ".", "isVisible", "(", ")", ":", "self", ".", "details", ".", "hide", "(", ")", "self", ".", "details_btn", ".", "setText", "(", "_", "(", "'Show details'", ")", ")", "else"...
Show traceback on its own dialog
[ "Show", "traceback", "on", "its", "own", "dialog" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L311-L323
train
spyder-ide/spyder
spyder/widgets/reporterror.py
SpyderErrorDialog._contents_changed
def _contents_changed(self): """Activate submit_btn.""" desc_chars = (len(self.input_description.toPlainText()) - self.initial_chars) if desc_chars < DESC_MIN_CHARS: self.desc_chars_label.setText( u"{} {}".format(DESC_MIN_CHARS - desc_chars, ...
python
def _contents_changed(self): """Activate submit_btn.""" desc_chars = (len(self.input_description.toPlainText()) - self.initial_chars) if desc_chars < DESC_MIN_CHARS: self.desc_chars_label.setText( u"{} {}".format(DESC_MIN_CHARS - desc_chars, ...
[ "def", "_contents_changed", "(", "self", ")", ":", "desc_chars", "=", "(", "len", "(", "self", ".", "input_description", ".", "toPlainText", "(", ")", ")", "-", "self", ".", "initial_chars", ")", "if", "desc_chars", "<", "DESC_MIN_CHARS", ":", "self", ".",...
Activate submit_btn.
[ "Activate", "submit_btn", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L325-L346
train
spyder-ide/spyder
spyder/plugins/editor/extensions/closebrackets.py
CloseBracketsExtension.unmatched_brackets_in_line
def unmatched_brackets_in_line(self, text, closing_brackets_type=None): """ Checks if there is an unmatched brackets in the 'text'. The brackets type can be general or specified by closing_brackets_type (')', ']' or '}') """ if closing_brackets_type is None: ...
python
def unmatched_brackets_in_line(self, text, closing_brackets_type=None): """ Checks if there is an unmatched brackets in the 'text'. The brackets type can be general or specified by closing_brackets_type (')', ']' or '}') """ if closing_brackets_type is None: ...
[ "def", "unmatched_brackets_in_line", "(", "self", ",", "text", ",", "closing_brackets_type", "=", "None", ")", ":", "if", "closing_brackets_type", "is", "None", ":", "opening_brackets", "=", "self", ".", "BRACKETS_LEFT", ".", "values", "(", ")", "closing_brackets"...
Checks if there is an unmatched brackets in the 'text'. The brackets type can be general or specified by closing_brackets_type (')', ']' or '}')
[ "Checks", "if", "there", "is", "an", "unmatched", "brackets", "in", "the", "text", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closebrackets.py#L44-L71
train
spyder-ide/spyder
spyder/plugins/editor/extensions/closebrackets.py
CloseBracketsExtension._autoinsert_brackets
def _autoinsert_brackets(self, key): """Control automatic insertation of brackets in various situations.""" char = self.BRACKETS_CHAR[key] pair = self.BRACKETS_PAIR[key] line_text = self.editor.get_text('sol', 'eol') line_to_cursor = self.editor.get_text('sol', 'cursor') ...
python
def _autoinsert_brackets(self, key): """Control automatic insertation of brackets in various situations.""" char = self.BRACKETS_CHAR[key] pair = self.BRACKETS_PAIR[key] line_text = self.editor.get_text('sol', 'eol') line_to_cursor = self.editor.get_text('sol', 'cursor') ...
[ "def", "_autoinsert_brackets", "(", "self", ",", "key", ")", ":", "char", "=", "self", ".", "BRACKETS_CHAR", "[", "key", "]", "pair", "=", "self", ".", "BRACKETS_PAIR", "[", "key", "]", "line_text", "=", "self", ".", "editor", ".", "get_text", "(", "'s...
Control automatic insertation of brackets in various situations.
[ "Control", "automatic", "insertation", "of", "brackets", "in", "various", "situations", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closebrackets.py#L73-L114
train
jrosebr1/imutils
imutils/convenience.py
build_montages
def build_montages(image_list, image_shape, montage_shape): """ --------------------------------------------------------------------------------------------- author: Kyle Hounslow --------------------------------------------------------------------------------------------- Converts a list of single ...
python
def build_montages(image_list, image_shape, montage_shape): """ --------------------------------------------------------------------------------------------- author: Kyle Hounslow --------------------------------------------------------------------------------------------- Converts a list of single ...
[ "def", "build_montages", "(", "image_list", ",", "image_shape", ",", "montage_shape", ")", ":", "if", "len", "(", "image_shape", ")", "!=", "2", ":", "raise", "Exception", "(", "'image shape must be list or tuple of length 2 (rows, cols)'", ")", "if", "len", "(", ...
--------------------------------------------------------------------------------------------- author: Kyle Hounslow --------------------------------------------------------------------------------------------- Converts a list of single images into a list of 'montage' images of specified rows and columns. ...
[ "---------------------------------------------------------------------------------------------", "author", ":", "Kyle", "Hounslow", "---------------------------------------------------------------------------------------------", "Converts", "a", "list", "of", "single", "images", "into", "a...
4430083199793bd66db64e574379cbe18414d420
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/convenience.py#L238-L301
train
jrosebr1/imutils
imutils/convenience.py
adjust_brightness_contrast
def adjust_brightness_contrast(image, brightness=0., contrast=0.): """ Adjust the brightness and/or contrast of an image :param image: OpenCV BGR image :param contrast: Float, contrast adjustment with 0 meaning no change :param brightness: Float, brightness adjustment with 0 meaning no change "...
python
def adjust_brightness_contrast(image, brightness=0., contrast=0.): """ Adjust the brightness and/or contrast of an image :param image: OpenCV BGR image :param contrast: Float, contrast adjustment with 0 meaning no change :param brightness: Float, brightness adjustment with 0 meaning no change "...
[ "def", "adjust_brightness_contrast", "(", "image", ",", "brightness", "=", "0.", ",", "contrast", "=", "0.", ")", ":", "beta", "=", "0", "# See the OpenCV docs for more info on the `beta` parameter to addWeighted", "# https://docs.opencv.org/3.4.2/d2/de8/group__core__array.html#g...
Adjust the brightness and/or contrast of an image :param image: OpenCV BGR image :param contrast: Float, contrast adjustment with 0 meaning no change :param brightness: Float, brightness adjustment with 0 meaning no change
[ "Adjust", "the", "brightness", "and", "/", "or", "contrast", "of", "an", "image" ]
4430083199793bd66db64e574379cbe18414d420
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/convenience.py#L304-L319
train
jrosebr1/imutils
imutils/text.py
put_text
def put_text(img, text, org, font_face, font_scale, color, thickness=1, line_type=8, bottom_left_origin=False): """Utility for drawing text with line breaks :param img: Image. :param text: Text string to be drawn. :param org: Bottom-left corner of the first line of the text string in the image. :pa...
python
def put_text(img, text, org, font_face, font_scale, color, thickness=1, line_type=8, bottom_left_origin=False): """Utility for drawing text with line breaks :param img: Image. :param text: Text string to be drawn. :param org: Bottom-left corner of the first line of the text string in the image. :pa...
[ "def", "put_text", "(", "img", ",", "text", ",", "org", ",", "font_face", ",", "font_scale", ",", "color", ",", "thickness", "=", "1", ",", "line_type", "=", "8", ",", "bottom_left_origin", "=", "False", ")", ":", "# Break out drawing coords", "x", ",", ...
Utility for drawing text with line breaks :param img: Image. :param text: Text string to be drawn. :param org: Bottom-left corner of the first line of the text string in the image. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, ...
[ "Utility", "for", "drawing", "text", "with", "line", "breaks" ]
4430083199793bd66db64e574379cbe18414d420
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/text.py#L4-L52
train
jrosebr1/imutils
imutils/text.py
put_centered_text
def put_centered_text(img, text, font_face, font_scale, color, thickness=1, line_type=8): """Utility for drawing vertically & horizontally centered text with line breaks :param img: Image. :param text: Text string to be drawn. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN...
python
def put_centered_text(img, text, font_face, font_scale, color, thickness=1, line_type=8): """Utility for drawing vertically & horizontally centered text with line breaks :param img: Image. :param text: Text string to be drawn. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN...
[ "def", "put_centered_text", "(", "img", ",", "text", ",", "font_face", ",", "font_scale", ",", "color", ",", "thickness", "=", "1", ",", "line_type", "=", "8", ")", ":", "# Save img dimensions", "img_h", ",", "img_w", "=", "img", ".", "shape", "[", ":", ...
Utility for drawing vertically & horizontally centered text with line breaks :param img: Image. :param text: Text string to be drawn. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT...
[ "Utility", "for", "drawing", "vertically", "&", "horizontally", "centered", "text", "with", "line", "breaks" ]
4430083199793bd66db64e574379cbe18414d420
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/text.py#L55-L107
train
jrosebr1/imutils
imutils/feature/helpers.py
corners_to_keypoints
def corners_to_keypoints(corners): """function to take the corners from cv2.GoodFeaturesToTrack and return cv2.KeyPoints""" if corners is None: keypoints = [] else: keypoints = [cv2.KeyPoint(kp[0][0], kp[0][1], 1) for kp in corners] return keypoints
python
def corners_to_keypoints(corners): """function to take the corners from cv2.GoodFeaturesToTrack and return cv2.KeyPoints""" if corners is None: keypoints = [] else: keypoints = [cv2.KeyPoint(kp[0][0], kp[0][1], 1) for kp in corners] return keypoints
[ "def", "corners_to_keypoints", "(", "corners", ")", ":", "if", "corners", "is", "None", ":", "keypoints", "=", "[", "]", "else", ":", "keypoints", "=", "[", "cv2", ".", "KeyPoint", "(", "kp", "[", "0", "]", "[", "0", "]", ",", "kp", "[", "0", "]"...
function to take the corners from cv2.GoodFeaturesToTrack and return cv2.KeyPoints
[ "function", "to", "take", "the", "corners", "from", "cv2", ".", "GoodFeaturesToTrack", "and", "return", "cv2", ".", "KeyPoints" ]
4430083199793bd66db64e574379cbe18414d420
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/feature/helpers.py#L4-L11
train
sdispater/poetry
poetry/packages/utils/utils.py
path_to_url
def path_to_url(path): """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urlparse.urljoin("file:", urllib2.pathname2url(path)) return url
python
def path_to_url(path): """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urlparse.urljoin("file:", urllib2.pathname2url(path)) return url
[ "def", "path_to_url", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "path", ")", ")", "url", "=", "urlparse", ".", "urljoin", "(", "\"file:\"", ",", "urllib2", ".", "pathname2url"...
Convert a path to a file: URL. The path will be made absolute and have quoted path parts.
[ "Convert", "a", "path", "to", "a", "file", ":", "URL", ".", "The", "path", "will", "be", "made", "absolute", "and", "have", "quoted", "path", "parts", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/utils/utils.py#L49-L56
train
sdispater/poetry
poetry/packages/utils/utils.py
is_installable_dir
def is_installable_dir(path): """Return True if `path` is a directory containing a setup.py file.""" if not os.path.isdir(path): return False setup_py = os.path.join(path, "setup.py") if os.path.isfile(setup_py): return True return False
python
def is_installable_dir(path): """Return True if `path` is a directory containing a setup.py file.""" if not os.path.isdir(path): return False setup_py = os.path.join(path, "setup.py") if os.path.isfile(setup_py): return True return False
[ "def", "is_installable_dir", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "return", "False", "setup_py", "=", "os", ".", "path", ".", "join", "(", "path", ",", "\"setup.py\"", ")", "if", "os", ".", "pa...
Return True if `path` is a directory containing a setup.py file.
[ "Return", "True", "if", "path", "is", "a", "directory", "containing", "a", "setup", ".", "py", "file", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/utils/utils.py#L90-L97
train
sdispater/poetry
poetry/config.py
Config.setting
def setting(self, setting_name, default=None): # type: (str) -> Any """ Retrieve a setting value. """ keys = setting_name.split(".") config = self._content for key in keys: if key not in config: return default config = config[key...
python
def setting(self, setting_name, default=None): # type: (str) -> Any """ Retrieve a setting value. """ keys = setting_name.split(".") config = self._content for key in keys: if key not in config: return default config = config[key...
[ "def", "setting", "(", "self", ",", "setting_name", ",", "default", "=", "None", ")", ":", "# type: (str) -> Any", "keys", "=", "setting_name", ".", "split", "(", "\".\"", ")", "config", "=", "self", ".", "_content", "for", "key", "in", "keys", ":", "if"...
Retrieve a setting value.
[ "Retrieve", "a", "setting", "value", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/config.py#L36-L49
train
sdispater/poetry
poetry/masonry/api.py
get_requires_for_build_wheel
def get_requires_for_build_wheel(config_settings=None): """ Returns a list of requirements for building, as strings """ poetry = Poetry.create(".") main, _ = SdistBuilder.convert_dependencies(poetry.package, poetry.package.requires) return main
python
def get_requires_for_build_wheel(config_settings=None): """ Returns a list of requirements for building, as strings """ poetry = Poetry.create(".") main, _ = SdistBuilder.convert_dependencies(poetry.package, poetry.package.requires) return main
[ "def", "get_requires_for_build_wheel", "(", "config_settings", "=", "None", ")", ":", "poetry", "=", "Poetry", ".", "create", "(", "\".\"", ")", "main", ",", "_", "=", "SdistBuilder", ".", "convert_dependencies", "(", "poetry", ".", "package", ",", "poetry", ...
Returns a list of requirements for building, as strings
[ "Returns", "a", "list", "of", "requirements", "for", "building", "as", "strings" ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/api.py#L19-L27
train
sdispater/poetry
poetry/masonry/api.py
build_wheel
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): """Builds a wheel, places it in wheel_directory""" poetry = Poetry.create(".") return unicode( WheelBuilder.make_in( poetry, SystemEnv(Path(sys.prefix)), NullIO(), Path(wheel_directory) ) )
python
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): """Builds a wheel, places it in wheel_directory""" poetry = Poetry.create(".") return unicode( WheelBuilder.make_in( poetry, SystemEnv(Path(sys.prefix)), NullIO(), Path(wheel_directory) ) )
[ "def", "build_wheel", "(", "wheel_directory", ",", "config_settings", "=", "None", ",", "metadata_directory", "=", "None", ")", ":", "poetry", "=", "Poetry", ".", "create", "(", "\".\"", ")", "return", "unicode", "(", "WheelBuilder", ".", "make_in", "(", "po...
Builds a wheel, places it in wheel_directory
[ "Builds", "a", "wheel", "places", "it", "in", "wheel_directory" ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/api.py#L54-L62
train
sdispater/poetry
poetry/masonry/api.py
build_sdist
def build_sdist(sdist_directory, config_settings=None): """Builds an sdist, places it in sdist_directory""" poetry = Poetry.create(".") path = SdistBuilder(poetry, SystemEnv(Path(sys.prefix)), NullIO()).build( Path(sdist_directory) ) return unicode(path.name)
python
def build_sdist(sdist_directory, config_settings=None): """Builds an sdist, places it in sdist_directory""" poetry = Poetry.create(".") path = SdistBuilder(poetry, SystemEnv(Path(sys.prefix)), NullIO()).build( Path(sdist_directory) ) return unicode(path.name)
[ "def", "build_sdist", "(", "sdist_directory", ",", "config_settings", "=", "None", ")", ":", "poetry", "=", "Poetry", ".", "create", "(", "\".\"", ")", "path", "=", "SdistBuilder", "(", "poetry", ",", "SystemEnv", "(", "Path", "(", "sys", ".", "prefix", ...
Builds an sdist, places it in sdist_directory
[ "Builds", "an", "sdist", "places", "it", "in", "sdist_directory" ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/api.py#L65-L73
train
sdispater/poetry
poetry/mixology/incompatibility.py
Incompatibility.external_incompatibilities
def external_incompatibilities(self): # type: () -> Generator[Incompatibility] """ Returns all external incompatibilities in this incompatibility's derivation graph. """ if isinstance(self._cause, ConflictCause): cause = self._cause # type: ConflictCause ...
python
def external_incompatibilities(self): # type: () -> Generator[Incompatibility] """ Returns all external incompatibilities in this incompatibility's derivation graph. """ if isinstance(self._cause, ConflictCause): cause = self._cause # type: ConflictCause ...
[ "def", "external_incompatibilities", "(", "self", ")", ":", "# type: () -> Generator[Incompatibility]", "if", "isinstance", "(", "self", ".", "_cause", ",", "ConflictCause", ")", ":", "cause", "=", "self", ".", "_cause", "# type: ConflictCause", "for", "incompatibilit...
Returns all external incompatibilities in this incompatibility's derivation graph.
[ "Returns", "all", "external", "incompatibilities", "in", "this", "incompatibility", "s", "derivation", "graph", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/incompatibility.py#L88-L101
train
sdispater/poetry
poetry/mixology/partial_solution.py
PartialSolution.decide
def decide(self, package): # type: (Package) -> None """ Adds an assignment of package as a decision and increments the decision level. """ # When we make a new decision after backtracking, count an additional # attempted solution. If we backtrack multiple times in a row...
python
def decide(self, package): # type: (Package) -> None """ Adds an assignment of package as a decision and increments the decision level. """ # When we make a new decision after backtracking, count an additional # attempted solution. If we backtrack multiple times in a row...
[ "def", "decide", "(", "self", ",", "package", ")", ":", "# type: (Package) -> None", "# When we make a new decision after backtracking, count an additional", "# attempted solution. If we backtrack multiple times in a row, though, we", "# only want to count one, since we haven't actually starte...
Adds an assignment of package as a decision and increments the decision level.
[ "Adds", "an", "assignment", "of", "package", "as", "a", "decision", "and", "increments", "the", "decision", "level", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L73-L90
train
sdispater/poetry
poetry/mixology/partial_solution.py
PartialSolution.derive
def derive( self, dependency, is_positive, cause ): # type: (Dependency, bool, Incompatibility) -> None """ Adds an assignment of package as a derivation. """ self._assign( Assignment.derivation( dependency, is_positive, ...
python
def derive( self, dependency, is_positive, cause ): # type: (Dependency, bool, Incompatibility) -> None """ Adds an assignment of package as a derivation. """ self._assign( Assignment.derivation( dependency, is_positive, ...
[ "def", "derive", "(", "self", ",", "dependency", ",", "is_positive", ",", "cause", ")", ":", "# type: (Dependency, bool, Incompatibility) -> None", "self", ".", "_assign", "(", "Assignment", ".", "derivation", "(", "dependency", ",", "is_positive", ",", "cause", "...
Adds an assignment of package as a derivation.
[ "Adds", "an", "assignment", "of", "package", "as", "a", "derivation", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L92-L106
train
sdispater/poetry
poetry/mixology/partial_solution.py
PartialSolution._assign
def _assign(self, assignment): # type: (Assignment) -> None """ Adds an Assignment to _assignments and _positive or _negative. """ self._assignments.append(assignment) self._register(assignment)
python
def _assign(self, assignment): # type: (Assignment) -> None """ Adds an Assignment to _assignments and _positive or _negative. """ self._assignments.append(assignment) self._register(assignment)
[ "def", "_assign", "(", "self", ",", "assignment", ")", ":", "# type: (Assignment) -> None", "self", ".", "_assignments", ".", "append", "(", "assignment", ")", "self", ".", "_register", "(", "assignment", ")" ]
Adds an Assignment to _assignments and _positive or _negative.
[ "Adds", "an", "Assignment", "to", "_assignments", "and", "_positive", "or", "_negative", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L108-L113
train
sdispater/poetry
poetry/mixology/partial_solution.py
PartialSolution.backtrack
def backtrack(self, decision_level): # type: (int) -> None """ Resets the current decision level to decision_level, and removes all assignments made after that level. """ self._backtracking = True packages = set() while self._assignments[-1].decision_level > dec...
python
def backtrack(self, decision_level): # type: (int) -> None """ Resets the current decision level to decision_level, and removes all assignments made after that level. """ self._backtracking = True packages = set() while self._assignments[-1].decision_level > dec...
[ "def", "backtrack", "(", "self", ",", "decision_level", ")", ":", "# type: (int) -> None", "self", ".", "_backtracking", "=", "True", "packages", "=", "set", "(", ")", "while", "self", ".", "_assignments", "[", "-", "1", "]", ".", "decision_level", ">", "d...
Resets the current decision level to decision_level, and removes all assignments made after that level.
[ "Resets", "the", "current", "decision", "level", "to", "decision_level", "and", "removes", "all", "assignments", "made", "after", "that", "level", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L115-L139
train
sdispater/poetry
poetry/mixology/partial_solution.py
PartialSolution._register
def _register(self, assignment): # type: (Assignment) -> None """ Registers an Assignment in _positive or _negative. """ name = assignment.dependency.name old_positive = self._positive.get(name) if old_positive is not None: self._positive[name] = old_positive...
python
def _register(self, assignment): # type: (Assignment) -> None """ Registers an Assignment in _positive or _negative. """ name = assignment.dependency.name old_positive = self._positive.get(name) if old_positive is not None: self._positive[name] = old_positive...
[ "def", "_register", "(", "self", ",", "assignment", ")", ":", "# type: (Assignment) -> None", "name", "=", "assignment", ".", "dependency", ".", "name", "old_positive", "=", "self", ".", "_positive", ".", "get", "(", "name", ")", "if", "old_positive", "is", ...
Registers an Assignment in _positive or _negative.
[ "Registers", "an", "Assignment", "in", "_positive", "or", "_negative", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L141-L169
train
sdispater/poetry
poetry/mixology/partial_solution.py
PartialSolution.satisfier
def satisfier(self, term): # type: (Term) -> Assignment """ Returns the first Assignment in this solution such that the sublist of assignments up to and including that entry collectively satisfies term. """ assigned_term = None # type: Term for assignment in self._assi...
python
def satisfier(self, term): # type: (Term) -> Assignment """ Returns the first Assignment in this solution such that the sublist of assignments up to and including that entry collectively satisfies term. """ assigned_term = None # type: Term for assignment in self._assi...
[ "def", "satisfier", "(", "self", ",", "term", ")", ":", "# type: (Term) -> Assignment", "assigned_term", "=", "None", "# type: Term", "for", "assignment", "in", "self", ".", "_assignments", ":", "if", "assignment", ".", "dependency", ".", "name", "!=", "term", ...
Returns the first Assignment in this solution such that the sublist of assignments up to and including that entry collectively satisfies term.
[ "Returns", "the", "first", "Assignment", "in", "this", "solution", "such", "that", "the", "sublist", "of", "assignments", "up", "to", "and", "including", "that", "entry", "collectively", "satisfies", "term", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L171-L202
train
sdispater/poetry
poetry/poetry.py
Poetry.check
def check(cls, config, strict=False): # type: (dict, bool) -> Dict[str, List[str]] """ Checks the validity of a configuration """ result = {"errors": [], "warnings": []} # Schema validation errors validation_errors = validate_object(config, "poetry-schema") resu...
python
def check(cls, config, strict=False): # type: (dict, bool) -> Dict[str, List[str]] """ Checks the validity of a configuration """ result = {"errors": [], "warnings": []} # Schema validation errors validation_errors = validate_object(config, "poetry-schema") resu...
[ "def", "check", "(", "cls", ",", "config", ",", "strict", "=", "False", ")", ":", "# type: (dict, bool) -> Dict[str, List[str]]", "result", "=", "{", "\"errors\"", ":", "[", "]", ",", "\"warnings\"", ":", "[", "]", "}", "# Schema validation errors", "validation_...
Checks the validity of a configuration
[ "Checks", "the", "validity", "of", "a", "configuration" ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/poetry.py#L220-L265
train
sdispater/poetry
poetry/masonry/builders/sdist.py
SdistBuilder.find_packages
def find_packages(self, include): """ Discover subpackages and data. It also retrieves necessary files. """ pkgdir = None if include.source is not None: pkgdir = str(include.base) base = str(include.elements[0].parent) pkg_name = include.pac...
python
def find_packages(self, include): """ Discover subpackages and data. It also retrieves necessary files. """ pkgdir = None if include.source is not None: pkgdir = str(include.base) base = str(include.elements[0].parent) pkg_name = include.pac...
[ "def", "find_packages", "(", "self", ",", "include", ")", ":", "pkgdir", "=", "None", "if", "include", ".", "source", "is", "not", "None", ":", "pkgdir", "=", "str", "(", "include", ".", "base", ")", "base", "=", "str", "(", "include", ".", "elements...
Discover subpackages and data. It also retrieves necessary files.
[ "Discover", "subpackages", "and", "data", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/sdist.py#L189-L259
train
sdispater/poetry
poetry/masonry/builders/sdist.py
SdistBuilder.clean_tarinfo
def clean_tarinfo(cls, tar_info): """ Clean metadata from a TarInfo object to make it more reproducible. - Set uid & gid to 0 - Set uname and gname to "" - Normalise permissions to 644 or 755 - Set mtime if not None """ ti = copy(tar_info)...
python
def clean_tarinfo(cls, tar_info): """ Clean metadata from a TarInfo object to make it more reproducible. - Set uid & gid to 0 - Set uname and gname to "" - Normalise permissions to 644 or 755 - Set mtime if not None """ ti = copy(tar_info)...
[ "def", "clean_tarinfo", "(", "cls", ",", "tar_info", ")", ":", "ti", "=", "copy", "(", "tar_info", ")", "ti", ".", "uid", "=", "0", "ti", ".", "gid", "=", "0", "ti", ".", "uname", "=", "\"\"", "ti", ".", "gname", "=", "\"\"", "ti", ".", "mode",...
Clean metadata from a TarInfo object to make it more reproducible. - Set uid & gid to 0 - Set uname and gname to "" - Normalise permissions to 644 or 755 - Set mtime if not None
[ "Clean", "metadata", "from", "a", "TarInfo", "object", "to", "make", "it", "more", "reproducible", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/sdist.py#L321-L337
train
sdispater/poetry
poetry/utils/shell.py
Shell.get
def get(cls): # type: () -> Shell """ Retrieve the current shell. """ if cls._shell is not None: return cls._shell try: name, path = detect_shell(os.getpid()) except (RuntimeError, ShellDetectionFailure): raise RuntimeError("Unable to...
python
def get(cls): # type: () -> Shell """ Retrieve the current shell. """ if cls._shell is not None: return cls._shell try: name, path = detect_shell(os.getpid()) except (RuntimeError, ShellDetectionFailure): raise RuntimeError("Unable to...
[ "def", "get", "(", "cls", ")", ":", "# type: () -> Shell", "if", "cls", ".", "_shell", "is", "not", "None", ":", "return", "cls", ".", "_shell", "try", ":", "name", ",", "path", "=", "detect_shell", "(", "os", ".", "getpid", "(", ")", ")", "except", ...
Retrieve the current shell.
[ "Retrieve", "the", "current", "shell", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/utils/shell.py#L27-L41
train
sdispater/poetry
poetry/puzzle/provider.py
Provider.search_for
def search_for(self, dependency): # type: (Dependency) -> List[Package] """ Search for the specifications that match the given dependency. The specifications in the returned list will be considered in reverse order, so the latest version ought to be last. """ if depende...
python
def search_for(self, dependency): # type: (Dependency) -> List[Package] """ Search for the specifications that match the given dependency. The specifications in the returned list will be considered in reverse order, so the latest version ought to be last. """ if depende...
[ "def", "search_for", "(", "self", ",", "dependency", ")", ":", "# type: (Dependency) -> List[Package]", "if", "dependency", ".", "is_root", ":", "return", "PackageCollection", "(", "dependency", ",", "[", "self", ".", "_package", "]", ")", "for", "constraint", "...
Search for the specifications that match the given dependency. The specifications in the returned list will be considered in reverse order, so the latest version ought to be last.
[ "Search", "for", "the", "specifications", "that", "match", "the", "given", "dependency", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/puzzle/provider.py#L100-L158
train
sdispater/poetry
poetry/puzzle/provider.py
Provider.search_for_vcs
def search_for_vcs(self, dependency): # type: (VCSDependency) -> List[Package] """ Search for the specifications that match the given VCS dependency. Basically, we clone the repository in a temporary directory and get the information we need by checking out the specified reference. ...
python
def search_for_vcs(self, dependency): # type: (VCSDependency) -> List[Package] """ Search for the specifications that match the given VCS dependency. Basically, we clone the repository in a temporary directory and get the information we need by checking out the specified reference. ...
[ "def", "search_for_vcs", "(", "self", ",", "dependency", ")", ":", "# type: (VCSDependency) -> List[Package]", "if", "dependency", ".", "vcs", "!=", "\"git\"", ":", "raise", "ValueError", "(", "\"Unsupported VCS dependency {}\"", ".", "format", "(", "dependency", ".",...
Search for the specifications that match the given VCS dependency. Basically, we clone the repository in a temporary directory and get the information we need by checking out the specified reference.
[ "Search", "for", "the", "specifications", "that", "match", "the", "given", "VCS", "dependency", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/puzzle/provider.py#L160-L200
train
sdispater/poetry
poetry/puzzle/provider.py
Provider.incompatibilities_for
def incompatibilities_for( self, package ): # type: (DependencyPackage) -> List[Incompatibility] """ Returns incompatibilities that encapsulate a given package's dependencies, or that it can't be safely selected. If multiple subsequent versions of this package have the same...
python
def incompatibilities_for( self, package ): # type: (DependencyPackage) -> List[Incompatibility] """ Returns incompatibilities that encapsulate a given package's dependencies, or that it can't be safely selected. If multiple subsequent versions of this package have the same...
[ "def", "incompatibilities_for", "(", "self", ",", "package", ")", ":", "# type: (DependencyPackage) -> List[Incompatibility]", "if", "package", ".", "is_root", "(", ")", ":", "dependencies", "=", "package", ".", "all_requires", "else", ":", "dependencies", "=", "pac...
Returns incompatibilities that encapsulate a given package's dependencies, or that it can't be safely selected. If multiple subsequent versions of this package have the same dependencies, this will return incompatibilities that reflect that. It won't return incompatibilities that have a...
[ "Returns", "incompatibilities", "that", "encapsulate", "a", "given", "package", "s", "dependencies", "or", "that", "it", "can", "t", "be", "safely", "selected", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/puzzle/provider.py#L393-L449
train
sdispater/poetry
poetry/mixology/version_solver.py
VersionSolver.solve
def solve(self): # type: () -> SolverResult """ Finds a set of dependencies that match the root package's constraints, or raises an error if no such set is available. """ start = time.time() root_dependency = Dependency(self._root.name, self._root.version) root_d...
python
def solve(self): # type: () -> SolverResult """ Finds a set of dependencies that match the root package's constraints, or raises an error if no such set is available. """ start = time.time() root_dependency = Dependency(self._root.name, self._root.version) root_d...
[ "def", "solve", "(", "self", ")", ":", "# type: () -> SolverResult", "start", "=", "time", ".", "time", "(", ")", "root_dependency", "=", "Dependency", "(", "self", ".", "_root", ".", "name", ",", "self", ".", "_root", ".", "version", ")", "root_dependency...
Finds a set of dependencies that match the root package's constraints, or raises an error if no such set is available.
[ "Finds", "a", "set", "of", "dependencies", "that", "match", "the", "root", "package", "s", "constraints", "or", "raises", "an", "error", "if", "no", "such", "set", "is", "available", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L62-L90
train
sdispater/poetry
poetry/mixology/version_solver.py
VersionSolver._propagate
def _propagate(self, package): # type: (str) -> None """ Performs unit propagation on incompatibilities transitively related to package to derive new assignments for _solution. """ changed = set() changed.add(package) while changed: package = changed...
python
def _propagate(self, package): # type: (str) -> None """ Performs unit propagation on incompatibilities transitively related to package to derive new assignments for _solution. """ changed = set() changed.add(package) while changed: package = changed...
[ "def", "_propagate", "(", "self", ",", "package", ")", ":", "# type: (str) -> None", "changed", "=", "set", "(", ")", "changed", ".", "add", "(", "package", ")", "while", "changed", ":", "package", "=", "changed", ".", "pop", "(", ")", "# Iterate in revers...
Performs unit propagation on incompatibilities transitively related to package to derive new assignments for _solution.
[ "Performs", "unit", "propagation", "on", "incompatibilities", "transitively", "related", "to", "package", "to", "derive", "new", "assignments", "for", "_solution", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L92-L127
train
sdispater/poetry
poetry/mixology/version_solver.py
VersionSolver._propagate_incompatibility
def _propagate_incompatibility( self, incompatibility ): # type: (Incompatibility) -> Union[str, _conflict, None] """ If incompatibility is almost satisfied by _solution, adds the negation of the unsatisfied term to _solution. If incompatibility is satisfied by _solution, r...
python
def _propagate_incompatibility( self, incompatibility ): # type: (Incompatibility) -> Union[str, _conflict, None] """ If incompatibility is almost satisfied by _solution, adds the negation of the unsatisfied term to _solution. If incompatibility is satisfied by _solution, r...
[ "def", "_propagate_incompatibility", "(", "self", ",", "incompatibility", ")", ":", "# type: (Incompatibility) -> Union[str, _conflict, None]", "# The first entry in incompatibility.terms that's not yet satisfied by", "# _solution, if one exists. If we find more than one, _solution is", "# inc...
If incompatibility is almost satisfied by _solution, adds the negation of the unsatisfied term to _solution. If incompatibility is satisfied by _solution, returns _conflict. If incompatibility is almost satisfied by _solution, returns the unsatisfied term's package name. Otherw...
[ "If", "incompatibility", "is", "almost", "satisfied", "by", "_solution", "adds", "the", "negation", "of", "the", "unsatisfied", "term", "to", "_solution", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L129-L181
train
sdispater/poetry
poetry/mixology/version_solver.py
VersionSolver._resolve_conflict
def _resolve_conflict( self, incompatibility ): # type: (Incompatibility) -> Incompatibility """ Given an incompatibility that's satisfied by _solution, The `conflict resolution`_ constructs a new incompatibility that encapsulates the root cause of the conflict and backtrack...
python
def _resolve_conflict( self, incompatibility ): # type: (Incompatibility) -> Incompatibility """ Given an incompatibility that's satisfied by _solution, The `conflict resolution`_ constructs a new incompatibility that encapsulates the root cause of the conflict and backtrack...
[ "def", "_resolve_conflict", "(", "self", ",", "incompatibility", ")", ":", "# type: (Incompatibility) -> Incompatibility", "self", ".", "_log", "(", "\"conflict: {}\"", ".", "format", "(", "incompatibility", ")", ")", "new_incompatibility", "=", "False", "while", "not...
Given an incompatibility that's satisfied by _solution, The `conflict resolution`_ constructs a new incompatibility that encapsulates the root cause of the conflict and backtracks _solution until the new incompatibility will allow _propagate() to deduce new assignments. Adds the new inc...
[ "Given", "an", "incompatibility", "that", "s", "satisfied", "by", "_solution", "The", "conflict", "resolution", "_", "constructs", "a", "new", "incompatibility", "that", "encapsulates", "the", "root", "cause", "of", "the", "conflict", "and", "backtracks", "_soluti...
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L183-L316
train
sdispater/poetry
poetry/mixology/version_solver.py
VersionSolver._choose_package_version
def _choose_package_version(self): # type: () -> Union[str, None] """ Tries to select a version of a required package. Returns the name of the package whose incompatibilities should be propagated by _propagate(), or None indicating that version solving is complete and a solutio...
python
def _choose_package_version(self): # type: () -> Union[str, None] """ Tries to select a version of a required package. Returns the name of the package whose incompatibilities should be propagated by _propagate(), or None indicating that version solving is complete and a solutio...
[ "def", "_choose_package_version", "(", "self", ")", ":", "# type: () -> Union[str, None]", "unsatisfied", "=", "self", ".", "_solution", ".", "unsatisfied", "if", "not", "unsatisfied", ":", "return", "# Prefer packages with as few remaining versions as possible,", "# so that ...
Tries to select a version of a required package. Returns the name of the package whose incompatibilities should be propagated by _propagate(), or None indicating that version solving is complete and a solution has been found.
[ "Tries", "to", "select", "a", "version", "of", "a", "required", "package", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L318-L402
train
sdispater/poetry
poetry/mixology/version_solver.py
VersionSolver._result
def _result(self): # type: () -> SolverResult """ Creates a #SolverResult from the decisions in _solution """ decisions = self._solution.decisions return SolverResult( self._root, [p for p in decisions if not p.is_root()], self._solution.atte...
python
def _result(self): # type: () -> SolverResult """ Creates a #SolverResult from the decisions in _solution """ decisions = self._solution.decisions return SolverResult( self._root, [p for p in decisions if not p.is_root()], self._solution.atte...
[ "def", "_result", "(", "self", ")", ":", "# type: () -> SolverResult", "decisions", "=", "self", ".", "_solution", ".", "decisions", "return", "SolverResult", "(", "self", ".", "_root", ",", "[", "p", "for", "p", "in", "decisions", "if", "not", "p", ".", ...
Creates a #SolverResult from the decisions in _solution
[ "Creates", "a", "#SolverResult", "from", "the", "decisions", "in", "_solution" ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L407-L417
train
sdispater/poetry
poetry/utils/env.py
Env.run
def run(self, bin, *args, **kwargs): """ Run a command inside the Python environment. """ bin = self._bin(bin) cmd = [bin] + list(args) shell = kwargs.get("shell", False) call = kwargs.pop("call", False) input_ = kwargs.pop("input_", None) if she...
python
def run(self, bin, *args, **kwargs): """ Run a command inside the Python environment. """ bin = self._bin(bin) cmd = [bin] + list(args) shell = kwargs.get("shell", False) call = kwargs.pop("call", False) input_ = kwargs.pop("input_", None) if she...
[ "def", "run", "(", "self", ",", "bin", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "bin", "=", "self", ".", "_bin", "(", "bin", ")", "cmd", "=", "[", "bin", "]", "+", "list", "(", "args", ")", "shell", "=", "kwargs", ".", "get", "(...
Run a command inside the Python environment.
[ "Run", "a", "command", "inside", "the", "Python", "environment", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/utils/env.py#L345-L381
train
sdispater/poetry
poetry/utils/env.py
Env._bin
def _bin(self, bin): # type: (str) -> str """ Return path to the given executable. """ bin_path = (self._bin_dir / bin).with_suffix(".exe" if self._is_windows else "") if not bin_path.exists(): return bin return str(bin_path)
python
def _bin(self, bin): # type: (str) -> str """ Return path to the given executable. """ bin_path = (self._bin_dir / bin).with_suffix(".exe" if self._is_windows else "") if not bin_path.exists(): return bin return str(bin_path)
[ "def", "_bin", "(", "self", ",", "bin", ")", ":", "# type: (str) -> str", "bin_path", "=", "(", "self", ".", "_bin_dir", "/", "bin", ")", ".", "with_suffix", "(", "\".exe\"", "if", "self", ".", "_is_windows", "else", "\"\"", ")", "if", "not", "bin_path",...
Return path to the given executable.
[ "Return", "path", "to", "the", "given", "executable", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/utils/env.py#L391-L399
train
sdispater/poetry
poetry/version/helpers.py
format_python_constraint
def format_python_constraint(constraint): """ This helper will help in transforming disjunctive constraint into proper constraint. """ if isinstance(constraint, Version): if constraint.precision >= 3: return "=={}".format(str(constraint)) # Transform 3.6 or 3 if ...
python
def format_python_constraint(constraint): """ This helper will help in transforming disjunctive constraint into proper constraint. """ if isinstance(constraint, Version): if constraint.precision >= 3: return "=={}".format(str(constraint)) # Transform 3.6 or 3 if ...
[ "def", "format_python_constraint", "(", "constraint", ")", ":", "if", "isinstance", "(", "constraint", ",", "Version", ")", ":", "if", "constraint", ".", "precision", ">=", "3", ":", "return", "\"=={}\"", ".", "format", "(", "str", "(", "constraint", ")", ...
This helper will help in transforming disjunctive constraint into proper constraint.
[ "This", "helper", "will", "help", "in", "transforming", "disjunctive", "constraint", "into", "proper", "constraint", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/version/helpers.py#L19-L56
train
sdispater/poetry
poetry/masonry/utils/tags.py
get_abbr_impl
def get_abbr_impl(env): """Return abbreviated implementation name.""" impl = env.python_implementation if impl == "PyPy": return "pp" elif impl == "Jython": return "jy" elif impl == "IronPython": return "ip" elif impl == "CPython": return "cp" raise LookupEr...
python
def get_abbr_impl(env): """Return abbreviated implementation name.""" impl = env.python_implementation if impl == "PyPy": return "pp" elif impl == "Jython": return "jy" elif impl == "IronPython": return "ip" elif impl == "CPython": return "cp" raise LookupEr...
[ "def", "get_abbr_impl", "(", "env", ")", ":", "impl", "=", "env", ".", "python_implementation", "if", "impl", "==", "\"PyPy\"", ":", "return", "\"pp\"", "elif", "impl", "==", "\"Jython\"", ":", "return", "\"jy\"", "elif", "impl", "==", "\"IronPython\"", ":",...
Return abbreviated implementation name.
[ "Return", "abbreviated", "implementation", "name", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/utils/tags.py#L15-L28
train
sdispater/poetry
poetry/masonry/utils/tags.py
get_impl_ver
def get_impl_ver(env): """Return implementation version.""" impl_ver = env.config_var("py_version_nodot") if not impl_ver or get_abbr_impl(env) == "pp": impl_ver = "".join(map(str, get_impl_version_info(env))) return impl_ver
python
def get_impl_ver(env): """Return implementation version.""" impl_ver = env.config_var("py_version_nodot") if not impl_ver or get_abbr_impl(env) == "pp": impl_ver = "".join(map(str, get_impl_version_info(env))) return impl_ver
[ "def", "get_impl_ver", "(", "env", ")", ":", "impl_ver", "=", "env", ".", "config_var", "(", "\"py_version_nodot\"", ")", "if", "not", "impl_ver", "or", "get_abbr_impl", "(", "env", ")", "==", "\"pp\"", ":", "impl_ver", "=", "\"\"", ".", "join", "(", "ma...
Return implementation version.
[ "Return", "implementation", "version", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/utils/tags.py#L31-L37
train
sdispater/poetry
poetry/masonry/utils/tags.py
get_flag
def get_flag(env, var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = env.config_var(var) if val is None: if warn: warnings.warn( "Config variable '{0}' is unset, Pyt...
python
def get_flag(env, var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = env.config_var(var) if val is None: if warn: warnings.warn( "Config variable '{0}' is unset, Pyt...
[ "def", "get_flag", "(", "env", ",", "var", ",", "fallback", ",", "expected", "=", "True", ",", "warn", "=", "True", ")", ":", "val", "=", "env", ".", "config_var", "(", "var", ")", "if", "val", "is", "None", ":", "if", "warn", ":", "warnings", "....
Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.
[ "Use", "a", "fallback", "method", "for", "determining", "SOABI", "flags", "if", "the", "needed", "config", "var", "is", "unset", "or", "unavailable", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/utils/tags.py#L50-L63
train
sdispater/poetry
poetry/packages/dependency.py
Dependency.accepts
def accepts(self, package): # type: (poetry.packages.Package) -> bool """ Determines if the given package matches this dependency. """ return ( self._name == package.name and self._constraint.allows(package.version) and (not package.is_prerelease() or...
python
def accepts(self, package): # type: (poetry.packages.Package) -> bool """ Determines if the given package matches this dependency. """ return ( self._name == package.name and self._constraint.allows(package.version) and (not package.is_prerelease() or...
[ "def", "accepts", "(", "self", ",", "package", ")", ":", "# type: (poetry.packages.Package) -> bool", "return", "(", "self", ".", "_name", "==", "package", ".", "name", "and", "self", ".", "_constraint", ".", "allows", "(", "package", ".", "version", ")", "a...
Determines if the given package matches this dependency.
[ "Determines", "if", "the", "given", "package", "matches", "this", "dependency", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/dependency.py#L166-L174
train
sdispater/poetry
poetry/packages/dependency.py
Dependency.deactivate
def deactivate(self): """ Set the dependency as optional. """ if not self._optional: self._optional = True self._activated = False
python
def deactivate(self): """ Set the dependency as optional. """ if not self._optional: self._optional = True self._activated = False
[ "def", "deactivate", "(", "self", ")", ":", "if", "not", "self", ".", "_optional", ":", "self", ".", "_optional", "=", "True", "self", ".", "_activated", "=", "False" ]
Set the dependency as optional.
[ "Set", "the", "dependency", "as", "optional", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/dependency.py#L282-L289
train
sdispater/poetry
get-poetry.py
Installer.install
def install(self, version, upgrade=False): """ Installs Poetry in $POETRY_HOME. """ print("Installing version: " + colorize("info", version)) self.make_lib(version) self.make_bin() self.make_env() self.update_path() return 0
python
def install(self, version, upgrade=False): """ Installs Poetry in $POETRY_HOME. """ print("Installing version: " + colorize("info", version)) self.make_lib(version) self.make_bin() self.make_env() self.update_path() return 0
[ "def", "install", "(", "self", ",", "version", ",", "upgrade", "=", "False", ")", ":", "print", "(", "\"Installing version: \"", "+", "colorize", "(", "\"info\"", ",", "version", ")", ")", "self", ".", "make_lib", "(", "version", ")", "self", ".", "make_...
Installs Poetry in $POETRY_HOME.
[ "Installs", "Poetry", "in", "$POETRY_HOME", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/get-poetry.py#L453-L464
train
sdispater/poetry
get-poetry.py
Installer.make_lib
def make_lib(self, version): """ Packs everything into a single lib/ directory. """ if os.path.exists(POETRY_LIB_BACKUP): shutil.rmtree(POETRY_LIB_BACKUP) # Backup the current installation if os.path.exists(POETRY_LIB): shutil.copytree(POETRY_LIB,...
python
def make_lib(self, version): """ Packs everything into a single lib/ directory. """ if os.path.exists(POETRY_LIB_BACKUP): shutil.rmtree(POETRY_LIB_BACKUP) # Backup the current installation if os.path.exists(POETRY_LIB): shutil.copytree(POETRY_LIB,...
[ "def", "make_lib", "(", "self", ",", "version", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "POETRY_LIB_BACKUP", ")", ":", "shutil", ".", "rmtree", "(", "POETRY_LIB_BACKUP", ")", "# Backup the current installation", "if", "os", ".", "path", ".", ...
Packs everything into a single lib/ directory.
[ "Packs", "everything", "into", "a", "single", "lib", "/", "directory", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/get-poetry.py#L466-L490
train
sdispater/poetry
get-poetry.py
Installer.update_path
def update_path(self): """ Tries to update the $PATH automatically. """ if WINDOWS: return self.add_to_windows_path() # Updating any profile we can on UNIX systems export_string = self.get_export_string() addition = "\n{}\n".format(export_string) ...
python
def update_path(self): """ Tries to update the $PATH automatically. """ if WINDOWS: return self.add_to_windows_path() # Updating any profile we can on UNIX systems export_string = self.get_export_string() addition = "\n{}\n".format(export_string) ...
[ "def", "update_path", "(", "self", ")", ":", "if", "WINDOWS", ":", "return", "self", ".", "add_to_windows_path", "(", ")", "# Updating any profile we can on UNIX systems", "export_string", "=", "self", ".", "get_export_string", "(", ")", "addition", "=", "\"\\n{}\\n...
Tries to update the $PATH automatically.
[ "Tries", "to", "update", "the", "$PATH", "automatically", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/get-poetry.py#L588-L613
train
sdispater/poetry
poetry/mixology/term.py
Term.satisfies
def satisfies(self, other): # type: (Term) -> bool """ Returns whether this term satisfies another. """ return ( self.dependency.name == other.dependency.name and self.relation(other) == SetRelation.SUBSET )
python
def satisfies(self, other): # type: (Term) -> bool """ Returns whether this term satisfies another. """ return ( self.dependency.name == other.dependency.name and self.relation(other) == SetRelation.SUBSET )
[ "def", "satisfies", "(", "self", ",", "other", ")", ":", "# type: (Term) -> bool", "return", "(", "self", ".", "dependency", ".", "name", "==", "other", ".", "dependency", ".", "name", "and", "self", ".", "relation", "(", "other", ")", "==", "SetRelation",...
Returns whether this term satisfies another.
[ "Returns", "whether", "this", "term", "satisfies", "another", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/term.py#L36-L43
train
sdispater/poetry
poetry/mixology/term.py
Term.relation
def relation(self, other): # type: (Term) -> int """ Returns the relationship between the package versions allowed by this term and another. """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".format(other, ...
python
def relation(self, other): # type: (Term) -> int """ Returns the relationship between the package versions allowed by this term and another. """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".format(other, ...
[ "def", "relation", "(", "self", ",", "other", ")", ":", "# type: (Term) -> int", "if", "self", ".", "dependency", ".", "name", "!=", "other", ".", "dependency", ".", "name", ":", "raise", "ValueError", "(", "\"{} should refer to {}\"", ".", "format", "(", "o...
Returns the relationship between the package versions allowed by this term and another.
[ "Returns", "the", "relationship", "between", "the", "package", "versions", "allowed", "by", "this", "term", "and", "another", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/term.py#L45-L107
train
sdispater/poetry
poetry/mixology/term.py
Term.intersect
def intersect(self, other): # type: (Term) -> Union[Term, None] """ Returns a Term that represents the packages allowed by both this term and another """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".forma...
python
def intersect(self, other): # type: (Term) -> Union[Term, None] """ Returns a Term that represents the packages allowed by both this term and another """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".forma...
[ "def", "intersect", "(", "self", ",", "other", ")", ":", "# type: (Term) -> Union[Term, None]", "if", "self", ".", "dependency", ".", "name", "!=", "other", ".", "dependency", ".", "name", ":", "raise", "ValueError", "(", "\"{} should refer to {}\"", ".", "forma...
Returns a Term that represents the packages allowed by both this term and another
[ "Returns", "a", "Term", "that", "represents", "the", "packages", "allowed", "by", "both", "this", "term", "and", "another" ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/term.py#L109-L141
train
sdispater/poetry
poetry/masonry/builders/builder.py
Builder.find_files_to_add
def find_files_to_add(self, exclude_build=True): # type: (bool) -> list """ Finds all files to add to the tarball """ to_add = [] for include in self._module.includes: for file in include.elements: if "__pycache__" in str(file): c...
python
def find_files_to_add(self, exclude_build=True): # type: (bool) -> list """ Finds all files to add to the tarball """ to_add = [] for include in self._module.includes: for file in include.elements: if "__pycache__" in str(file): c...
[ "def", "find_files_to_add", "(", "self", ",", "exclude_build", "=", "True", ")", ":", "# type: (bool) -> list", "to_add", "=", "[", "]", "for", "include", "in", "self", ".", "_module", ".", "includes", ":", "for", "file", "in", "include", ".", "elements", ...
Finds all files to add to the tarball
[ "Finds", "all", "files", "to", "add", "to", "the", "tarball" ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/builder.py#L89-L156
train
sdispater/poetry
poetry/version/__init__.py
parse
def parse( version, strict=False # type: str # type: bool ): # type:(...) -> Union[Version, LegacyVersion] """ Parse the given version string and return either a :class:`Version` object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version. ...
python
def parse( version, strict=False # type: str # type: bool ): # type:(...) -> Union[Version, LegacyVersion] """ Parse the given version string and return either a :class:`Version` object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version. ...
[ "def", "parse", "(", "version", ",", "strict", "=", "False", "# type: str # type: bool", ")", ":", "# type:(...) -> Union[Version, LegacyVersion]", "try", ":", "return", "Version", "(", "version", ")", "except", "InvalidVersion", ":", "if", "strict", ":", "raise", ...
Parse the given version string and return either a :class:`Version` object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version. If strict=True only PEP 440 versions will be accepted.
[ "Parse", "the", "given", "version", "string", "and", "return", "either", "a", ":", "class", ":", "Version", "object", "or", "a", "LegacyVersion", "object", "depending", "on", "if", "the", "given", "version", "is", "a", "valid", "PEP", "440", "version", "or...
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/version/__init__.py#L28-L44
train
sdispater/poetry
poetry/packages/locker.py
Locker.is_fresh
def is_fresh(self): # type: () -> bool """ Checks whether the lock file is still up to date with the current hash. """ lock = self._lock.read() metadata = lock.get("metadata", {}) if "content-hash" in metadata: return self._content_hash == lock["metadata"]["...
python
def is_fresh(self): # type: () -> bool """ Checks whether the lock file is still up to date with the current hash. """ lock = self._lock.read() metadata = lock.get("metadata", {}) if "content-hash" in metadata: return self._content_hash == lock["metadata"]["...
[ "def", "is_fresh", "(", "self", ")", ":", "# type: () -> bool", "lock", "=", "self", ".", "_lock", ".", "read", "(", ")", "metadata", "=", "lock", ".", "get", "(", "\"metadata\"", ",", "{", "}", ")", "if", "\"content-hash\"", "in", "metadata", ":", "re...
Checks whether the lock file is still up to date with the current hash.
[ "Checks", "whether", "the", "lock", "file", "is", "still", "up", "to", "date", "with", "the", "current", "hash", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/locker.py#L45-L55
train
sdispater/poetry
poetry/packages/locker.py
Locker.locked_repository
def locked_repository( self, with_dev_reqs=False ): # type: (bool) -> poetry.repositories.Repository """ Searches and returns a repository of locked packages. """ if not self.is_locked(): return poetry.repositories.Repository() lock_data = self.lock_data...
python
def locked_repository( self, with_dev_reqs=False ): # type: (bool) -> poetry.repositories.Repository """ Searches and returns a repository of locked packages. """ if not self.is_locked(): return poetry.repositories.Repository() lock_data = self.lock_data...
[ "def", "locked_repository", "(", "self", ",", "with_dev_reqs", "=", "False", ")", ":", "# type: (bool) -> poetry.repositories.Repository", "if", "not", "self", ".", "is_locked", "(", ")", ":", "return", "poetry", ".", "repositories", ".", "Repository", "(", ")", ...
Searches and returns a repository of locked packages.
[ "Searches", "and", "returns", "a", "repository", "of", "locked", "packages", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/locker.py#L57-L121
train
sdispater/poetry
poetry/packages/locker.py
Locker._get_content_hash
def _get_content_hash(self): # type: () -> str """ Returns the sha256 hash of the sorted content of the pyproject file. """ content = self._local_config relevant_content = {} for key in self._relevant_keys: relevant_content[key] = content.get(key) c...
python
def _get_content_hash(self): # type: () -> str """ Returns the sha256 hash of the sorted content of the pyproject file. """ content = self._local_config relevant_content = {} for key in self._relevant_keys: relevant_content[key] = content.get(key) c...
[ "def", "_get_content_hash", "(", "self", ")", ":", "# type: () -> str", "content", "=", "self", ".", "_local_config", "relevant_content", "=", "{", "}", "for", "key", "in", "self", ".", "_relevant_keys", ":", "relevant_content", "[", "key", "]", "=", "content"...
Returns the sha256 hash of the sorted content of the pyproject file.
[ "Returns", "the", "sha256", "hash", "of", "the", "sorted", "content", "of", "the", "pyproject", "file", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/locker.py#L165-L179
train
sdispater/poetry
poetry/repositories/installed_repository.py
InstalledRepository.load
def load(cls, env): # type: (Env) -> InstalledRepository """ Load installed packages. For now, it uses the pip "freeze" command. """ repo = cls() freeze_output = env.run("pip", "freeze") for line in freeze_output.split("\n"): if "==" in line: ...
python
def load(cls, env): # type: (Env) -> InstalledRepository """ Load installed packages. For now, it uses the pip "freeze" command. """ repo = cls() freeze_output = env.run("pip", "freeze") for line in freeze_output.split("\n"): if "==" in line: ...
[ "def", "load", "(", "cls", ",", "env", ")", ":", "# type: (Env) -> InstalledRepository", "repo", "=", "cls", "(", ")", "freeze_output", "=", "env", ".", "run", "(", "\"pip\"", ",", "\"freeze\"", ")", "for", "line", "in", "freeze_output", ".", "split", "(",...
Load installed packages. For now, it uses the pip "freeze" command.
[ "Load", "installed", "packages", "." ]
2d27acd76c165dd49f11934520a7973de7a3762a
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/installed_repository.py#L11-L44
train