id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,500 | spyder-ide/spyder | spyder/plugins/editor/widgets/codeeditor.py | get_file_language | def get_file_language(filename, text=None):
"""Get file language from filename"""
ext = osp.splitext(filename)[1]
if ext.startswith('.'):
ext = ext[1:] # file extension with leading dot
language = ext
if not ext:
if text is None:
text, _enc = encoding.read(filenam... | python | def get_file_language(filename, text=None):
"""Get file language from filename"""
ext = osp.splitext(filename)[1]
if ext.startswith('.'):
ext = ext[1:] # file extension with leading dot
language = ext
if not ext:
if text is None:
text, _enc = encoding.read(filenam... | [
"def",
"get_file_language",
"(",
"filename",
",",
"text",
"=",
"None",
")",
":",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"filename",
")",
"[",
"1",
"]",
"if",
"ext",
".",
"startswith",
"(",
"'.'",
")",
":",
"ext",
"=",
"ext",
"[",
"1",
":",
"]",... | Get file language from filename | [
"Get",
"file",
"language",
"from",
"filename"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/codeeditor.py#L175-L193 |
31,501 | spyder-ide/spyder | spyder/plugins/editor/widgets/codeeditor.py | GoToLineDialog.text_has_changed | def text_has_changed(self, text):
"""Line edit's text has changed"""
text = to_text_string(text)
if text:
self.lineno = int(text)
else:
self.lineno = None | python | def text_has_changed(self, text):
"""Line edit's text has changed"""
text = to_text_string(text)
if text:
self.lineno = int(text)
else:
self.lineno = None | [
"def",
"text_has_changed",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"to_text_string",
"(",
"text",
")",
"if",
"text",
":",
"self",
".",
"lineno",
"=",
"int",
"(",
"text",
")",
"else",
":",
"self",
".",
"lineno",
"=",
"None"
] | Line edit's text has changed | [
"Line",
"edit",
"s",
"text",
"has",
"changed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/codeeditor.py#L157-L163 |
31,502 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | save_figure_tofile | def save_figure_tofile(fig, fmt, fname):
"""Save fig to fname in the format specified by fmt."""
root, ext = osp.splitext(fname)
if ext == '.png' and fmt == 'image/svg+xml':
qimg = svg_to_image(fig)
qimg.save(fname)
else:
if fmt == 'image/svg+xml' and is_unicode(fig):
... | python | def save_figure_tofile(fig, fmt, fname):
"""Save fig to fname in the format specified by fmt."""
root, ext = osp.splitext(fname)
if ext == '.png' and fmt == 'image/svg+xml':
qimg = svg_to_image(fig)
qimg.save(fname)
else:
if fmt == 'image/svg+xml' and is_unicode(fig):
... | [
"def",
"save_figure_tofile",
"(",
"fig",
",",
"fmt",
",",
"fname",
")",
":",
"root",
",",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"fname",
")",
"if",
"ext",
"==",
"'.png'",
"and",
"fmt",
"==",
"'image/svg+xml'",
":",
"qimg",
"=",
"svg_to_image",
"(",
... | Save fig to fname in the format specified by fmt. | [
"Save",
"fig",
"to",
"fname",
"in",
"the",
"format",
"specified",
"by",
"fmt",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L38-L49 |
31,503 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | get_unique_figname | def get_unique_figname(dirname, root, ext):
"""
Append a number to "root" to form a filename that does not already exist
in "dirname".
"""
i = 1
figname = root + '_%d' % i + ext
while True:
if osp.exists(osp.join(dirname, figname)):
i += 1
figname = root + '_%... | python | def get_unique_figname(dirname, root, ext):
"""
Append a number to "root" to form a filename that does not already exist
in "dirname".
"""
i = 1
figname = root + '_%d' % i + ext
while True:
if osp.exists(osp.join(dirname, figname)):
i += 1
figname = root + '_%... | [
"def",
"get_unique_figname",
"(",
"dirname",
",",
"root",
",",
"ext",
")",
":",
"i",
"=",
"1",
"figname",
"=",
"root",
"+",
"'_%d'",
"%",
"i",
"+",
"ext",
"while",
"True",
":",
"if",
"osp",
".",
"exists",
"(",
"osp",
".",
"join",
"(",
"dirname",
... | Append a number to "root" to form a filename that does not already exist
in "dirname". | [
"Append",
"a",
"number",
"to",
"root",
"to",
"form",
"a",
"filename",
"that",
"does",
"not",
"already",
"exist",
"in",
"dirname",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L52-L64 |
31,504 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.setup | def setup(self, mute_inline_plotting=None, show_plot_outline=None):
"""Setup the figure browser with provided settings."""
assert self.shellwidget is not None
self.mute_inline_plotting = mute_inline_plotting
self.show_plot_outline = show_plot_outline
if self.figviewer is not No... | python | def setup(self, mute_inline_plotting=None, show_plot_outline=None):
"""Setup the figure browser with provided settings."""
assert self.shellwidget is not None
self.mute_inline_plotting = mute_inline_plotting
self.show_plot_outline = show_plot_outline
if self.figviewer is not No... | [
"def",
"setup",
"(",
"self",
",",
"mute_inline_plotting",
"=",
"None",
",",
"show_plot_outline",
"=",
"None",
")",
":",
"assert",
"self",
".",
"shellwidget",
"is",
"not",
"None",
"self",
".",
"mute_inline_plotting",
"=",
"mute_inline_plotting",
"self",
".",
"s... | Setup the figure browser with provided settings. | [
"Setup",
"the",
"figure",
"browser",
"with",
"provided",
"settings",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L97-L136 |
31,505 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.setup_toolbar | def setup_toolbar(self):
"""Setup the toolbar"""
savefig_btn = create_toolbutton(
self, icon=ima.icon('filesave'),
tip=_("Save Image As..."),
triggered=self.save_figure)
saveall_btn = create_toolbutton(
self, icon=ima.icon('save_al... | python | def setup_toolbar(self):
"""Setup the toolbar"""
savefig_btn = create_toolbutton(
self, icon=ima.icon('filesave'),
tip=_("Save Image As..."),
triggered=self.save_figure)
saveall_btn = create_toolbutton(
self, icon=ima.icon('save_al... | [
"def",
"setup_toolbar",
"(",
"self",
")",
":",
"savefig_btn",
"=",
"create_toolbutton",
"(",
"self",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'filesave'",
")",
",",
"tip",
"=",
"_",
"(",
"\"Save Image As...\"",
")",
",",
"triggered",
"=",
"self",
".",... | Setup the toolbar | [
"Setup",
"the",
"toolbar"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L138-L212 |
31,506 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.create_shortcuts | def create_shortcuts(self):
"""Create shortcuts for this widget."""
# Configurable
copyfig = config_shortcut(self.copy_figure, context='plots',
name='copy', parent=self)
prevfig = config_shortcut(self.go_previous_thumbnail, context='plots',
... | python | def create_shortcuts(self):
"""Create shortcuts for this widget."""
# Configurable
copyfig = config_shortcut(self.copy_figure, context='plots',
name='copy', parent=self)
prevfig = config_shortcut(self.go_previous_thumbnail, context='plots',
... | [
"def",
"create_shortcuts",
"(",
"self",
")",
":",
"# Configurable",
"copyfig",
"=",
"config_shortcut",
"(",
"self",
".",
"copy_figure",
",",
"context",
"=",
"'plots'",
",",
"name",
"=",
"'copy'",
",",
"parent",
"=",
"self",
")",
"prevfig",
"=",
"config_short... | Create shortcuts for this widget. | [
"Create",
"shortcuts",
"for",
"this",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L255-L265 |
31,507 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.option_changed | def option_changed(self, option, value):
"""Handle when the value of an option has changed"""
setattr(self, to_text_string(option), value)
self.shellwidget.set_namespace_view_settings()
if self.setup_in_progress is False:
self.sig_option_changed.emit(option, value) | python | def option_changed(self, option, value):
"""Handle when the value of an option has changed"""
setattr(self, to_text_string(option), value)
self.shellwidget.set_namespace_view_settings()
if self.setup_in_progress is False:
self.sig_option_changed.emit(option, value) | [
"def",
"option_changed",
"(",
"self",
",",
"option",
",",
"value",
")",
":",
"setattr",
"(",
"self",
",",
"to_text_string",
"(",
"option",
")",
",",
"value",
")",
"self",
".",
"shellwidget",
".",
"set_namespace_view_settings",
"(",
")",
"if",
"self",
".",
... | Handle when the value of an option has changed | [
"Handle",
"when",
"the",
"value",
"of",
"an",
"option",
"has",
"changed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L277-L282 |
31,508 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.show_fig_outline_in_viewer | def show_fig_outline_in_viewer(self, state):
"""Draw a frame around the figure viewer if state is True."""
if state is True:
self.figviewer.figcanvas.setStyleSheet(
"FigureCanvas{border: 1px solid lightgrey;}")
else:
self.figviewer.figcanvas.setStyleSh... | python | def show_fig_outline_in_viewer(self, state):
"""Draw a frame around the figure viewer if state is True."""
if state is True:
self.figviewer.figcanvas.setStyleSheet(
"FigureCanvas{border: 1px solid lightgrey;}")
else:
self.figviewer.figcanvas.setStyleSh... | [
"def",
"show_fig_outline_in_viewer",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"is",
"True",
":",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"setStyleSheet",
"(",
"\"FigureCanvas{border: 1px solid lightgrey;}\"",
")",
"else",
":",
"self",
".",
"f... | Draw a frame around the figure viewer if state is True. | [
"Draw",
"a",
"frame",
"around",
"the",
"figure",
"viewer",
"if",
"state",
"is",
"True",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L284-L291 |
31,509 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.set_shellwidget | def set_shellwidget(self, shellwidget):
"""Bind the shellwidget instance to the figure browser"""
self.shellwidget = shellwidget
shellwidget.set_figurebrowser(self)
shellwidget.sig_new_inline_figure.connect(self._handle_new_figure) | python | def set_shellwidget(self, shellwidget):
"""Bind the shellwidget instance to the figure browser"""
self.shellwidget = shellwidget
shellwidget.set_figurebrowser(self)
shellwidget.sig_new_inline_figure.connect(self._handle_new_figure) | [
"def",
"set_shellwidget",
"(",
"self",
",",
"shellwidget",
")",
":",
"self",
".",
"shellwidget",
"=",
"shellwidget",
"shellwidget",
".",
"set_figurebrowser",
"(",
"self",
")",
"shellwidget",
".",
"sig_new_inline_figure",
".",
"connect",
"(",
"self",
".",
"_handl... | Bind the shellwidget instance to the figure browser | [
"Bind",
"the",
"shellwidget",
"instance",
"to",
"the",
"figure",
"browser"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L293-L297 |
31,510 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.copy_figure | def copy_figure(self):
"""Copy figure from figviewer to clipboard."""
if self.figviewer and self.figviewer.figcanvas.fig:
self.figviewer.figcanvas.copy_figure() | python | def copy_figure(self):
"""Copy figure from figviewer to clipboard."""
if self.figviewer and self.figviewer.figcanvas.fig:
self.figviewer.figcanvas.copy_figure() | [
"def",
"copy_figure",
"(",
"self",
")",
":",
"if",
"self",
".",
"figviewer",
"and",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"fig",
":",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"copy_figure",
"(",
")"
] | Copy figure from figviewer to clipboard. | [
"Copy",
"figure",
"from",
"figviewer",
"to",
"clipboard",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L349-L352 |
31,511 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.setup_figcanvas | def setup_figcanvas(self):
"""Setup the FigureCanvas."""
self.figcanvas = FigureCanvas(background_color=self.background_color)
self.figcanvas.installEventFilter(self)
self.setWidget(self.figcanvas) | python | def setup_figcanvas(self):
"""Setup the FigureCanvas."""
self.figcanvas = FigureCanvas(background_color=self.background_color)
self.figcanvas.installEventFilter(self)
self.setWidget(self.figcanvas) | [
"def",
"setup_figcanvas",
"(",
"self",
")",
":",
"self",
".",
"figcanvas",
"=",
"FigureCanvas",
"(",
"background_color",
"=",
"self",
".",
"background_color",
")",
"self",
".",
"figcanvas",
".",
"installEventFilter",
"(",
"self",
")",
"self",
".",
"setWidget",... | Setup the FigureCanvas. | [
"Setup",
"the",
"FigureCanvas",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L382-L386 |
31,512 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.load_figure | def load_figure(self, fig, fmt):
"""Set a new figure in the figure canvas."""
self.figcanvas.load_figure(fig, fmt)
self.scale_image()
self.figcanvas.repaint() | python | def load_figure(self, fig, fmt):
"""Set a new figure in the figure canvas."""
self.figcanvas.load_figure(fig, fmt)
self.scale_image()
self.figcanvas.repaint() | [
"def",
"load_figure",
"(",
"self",
",",
"fig",
",",
"fmt",
")",
":",
"self",
".",
"figcanvas",
".",
"load_figure",
"(",
"fig",
",",
"fmt",
")",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"figcanvas",
".",
"repaint",
"(",
")"
] | Set a new figure in the figure canvas. | [
"Set",
"a",
"new",
"figure",
"in",
"the",
"figure",
"canvas",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L388-L392 |
31,513 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.eventFilter | def eventFilter(self, widget, event):
"""A filter to control the zooming and panning of the figure canvas."""
# ---- Zooming
if event.type() == QEvent.Wheel:
modifiers = QApplication.keyboardModifiers()
if modifiers == Qt.ControlModifier:
if event.angleDe... | python | def eventFilter(self, widget, event):
"""A filter to control the zooming and panning of the figure canvas."""
# ---- Zooming
if event.type() == QEvent.Wheel:
modifiers = QApplication.keyboardModifiers()
if modifiers == Qt.ControlModifier:
if event.angleDe... | [
"def",
"eventFilter",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"# ---- Zooming",
"if",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"Wheel",
":",
"modifiers",
"=",
"QApplication",
".",
"keyboardModifiers",
"(",
")",
"if",
"modifiers",
... | A filter to control the zooming and panning of the figure canvas. | [
"A",
"filter",
"to",
"control",
"the",
"zooming",
"and",
"panning",
"of",
"the",
"figure",
"canvas",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L394-L438 |
31,514 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.zoom_in | def zoom_in(self):
"""Scale the image up by one scale step."""
if self._scalefactor <= self._sfmax:
self._scalefactor += 1
self.scale_image()
self._adjust_scrollbar(self._scalestep)
self.sig_zoom_changed.emit(self.get_scaling()) | python | def zoom_in(self):
"""Scale the image up by one scale step."""
if self._scalefactor <= self._sfmax:
self._scalefactor += 1
self.scale_image()
self._adjust_scrollbar(self._scalestep)
self.sig_zoom_changed.emit(self.get_scaling()) | [
"def",
"zoom_in",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scalefactor",
"<=",
"self",
".",
"_sfmax",
":",
"self",
".",
"_scalefactor",
"+=",
"1",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"_adjust_scrollbar",
"(",
"self",
".",
"_scalestep",
... | Scale the image up by one scale step. | [
"Scale",
"the",
"image",
"up",
"by",
"one",
"scale",
"step",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L441-L447 |
31,515 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.zoom_out | def zoom_out(self):
"""Scale the image down by one scale step."""
if self._scalefactor >= self._sfmin:
self._scalefactor -= 1
self.scale_image()
self._adjust_scrollbar(1/self._scalestep)
self.sig_zoom_changed.emit(self.get_scaling()) | python | def zoom_out(self):
"""Scale the image down by one scale step."""
if self._scalefactor >= self._sfmin:
self._scalefactor -= 1
self.scale_image()
self._adjust_scrollbar(1/self._scalestep)
self.sig_zoom_changed.emit(self.get_scaling()) | [
"def",
"zoom_out",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scalefactor",
">=",
"self",
".",
"_sfmin",
":",
"self",
".",
"_scalefactor",
"-=",
"1",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"_adjust_scrollbar",
"(",
"1",
"/",
"self",
".",
... | Scale the image down by one scale step. | [
"Scale",
"the",
"image",
"down",
"by",
"one",
"scale",
"step",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L449-L455 |
31,516 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.scale_image | def scale_image(self):
"""Scale the image size."""
new_width = int(self.figcanvas.fwidth *
self._scalestep ** self._scalefactor)
new_height = int(self.figcanvas.fheight *
self._scalestep ** self._scalefactor)
self.figcanvas.setFixedSize(ne... | python | def scale_image(self):
"""Scale the image size."""
new_width = int(self.figcanvas.fwidth *
self._scalestep ** self._scalefactor)
new_height = int(self.figcanvas.fheight *
self._scalestep ** self._scalefactor)
self.figcanvas.setFixedSize(ne... | [
"def",
"scale_image",
"(",
"self",
")",
":",
"new_width",
"=",
"int",
"(",
"self",
".",
"figcanvas",
".",
"fwidth",
"*",
"self",
".",
"_scalestep",
"**",
"self",
".",
"_scalefactor",
")",
"new_height",
"=",
"int",
"(",
"self",
".",
"figcanvas",
".",
"f... | Scale the image size. | [
"Scale",
"the",
"image",
"size",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L457-L463 |
31,517 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer._adjust_scrollbar | def _adjust_scrollbar(self, f):
"""
Adjust the scrollbar position to take into account the zooming of
the figure.
"""
# Adjust horizontal scrollbar :
hb = self.horizontalScrollBar()
hb.setValue(int(f * hb.value() + ((f - 1) * hb.pageStep()/2)))
# Adjust t... | python | def _adjust_scrollbar(self, f):
"""
Adjust the scrollbar position to take into account the zooming of
the figure.
"""
# Adjust horizontal scrollbar :
hb = self.horizontalScrollBar()
hb.setValue(int(f * hb.value() + ((f - 1) * hb.pageStep()/2)))
# Adjust t... | [
"def",
"_adjust_scrollbar",
"(",
"self",
",",
"f",
")",
":",
"# Adjust horizontal scrollbar :",
"hb",
"=",
"self",
".",
"horizontalScrollBar",
"(",
")",
"hb",
".",
"setValue",
"(",
"int",
"(",
"f",
"*",
"hb",
".",
"value",
"(",
")",
"+",
"(",
"(",
"f",... | Adjust the scrollbar position to take into account the zooming of
the figure. | [
"Adjust",
"the",
"scrollbar",
"position",
"to",
"take",
"into",
"account",
"the",
"zooming",
"of",
"the",
"figure",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L474-L485 |
31,518 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.setup_scrollarea | def setup_scrollarea(self):
"""Setup the scrollarea that will contain the FigureThumbnails."""
self.view = QWidget()
self.scene = QGridLayout(self.view)
self.scene.setColumnStretch(0, 100)
self.scene.setColumnStretch(2, 100)
self.scrollarea = QScrollArea()
self.... | python | def setup_scrollarea(self):
"""Setup the scrollarea that will contain the FigureThumbnails."""
self.view = QWidget()
self.scene = QGridLayout(self.view)
self.scene.setColumnStretch(0, 100)
self.scene.setColumnStretch(2, 100)
self.scrollarea = QScrollArea()
self.... | [
"def",
"setup_scrollarea",
"(",
"self",
")",
":",
"self",
".",
"view",
"=",
"QWidget",
"(",
")",
"self",
".",
"scene",
"=",
"QGridLayout",
"(",
"self",
".",
"view",
")",
"self",
".",
"scene",
".",
"setColumnStretch",
"(",
"0",
",",
"100",
")",
"self"... | Setup the scrollarea that will contain the FigureThumbnails. | [
"Setup",
"the",
"scrollarea",
"that",
"will",
"contain",
"the",
"FigureThumbnails",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L517-L539 |
31,519 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.setup_arrow_buttons | def setup_arrow_buttons(self):
"""
Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea.
"""
# Get the height of the up/down arrow of the default vertical
# scrollbar :
vsb = self.scrollarea.verticalScrollBar()
style ... | python | def setup_arrow_buttons(self):
"""
Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea.
"""
# Get the height of the up/down arrow of the default vertical
# scrollbar :
vsb = self.scrollarea.verticalScrollBar()
style ... | [
"def",
"setup_arrow_buttons",
"(",
"self",
")",
":",
"# Get the height of the up/down arrow of the default vertical",
"# scrollbar :",
"vsb",
"=",
"self",
".",
"scrollarea",
".",
"verticalScrollBar",
"(",
")",
"style",
"=",
"vsb",
".",
"style",
"(",
")",
"opt",
"=",... | Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea. | [
"Setup",
"the",
"up",
"and",
"down",
"arrow",
"buttons",
"that",
"are",
"placed",
"at",
"the",
"top",
"and",
"bottom",
"of",
"the",
"scrollarea",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L541-L566 |
31,520 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_all_figures_as | def save_all_figures_as(self):
"""Save all the figures to a file."""
self.redirect_stdio.emit(False)
dirname = getexistingdirectory(self, caption='Save all figures',
basedir=getcwd_or_home())
self.redirect_stdio.emit(True)
if dirname:
... | python | def save_all_figures_as(self):
"""Save all the figures to a file."""
self.redirect_stdio.emit(False)
dirname = getexistingdirectory(self, caption='Save all figures',
basedir=getcwd_or_home())
self.redirect_stdio.emit(True)
if dirname:
... | [
"def",
"save_all_figures_as",
"(",
"self",
")",
":",
"self",
".",
"redirect_stdio",
".",
"emit",
"(",
"False",
")",
"dirname",
"=",
"getexistingdirectory",
"(",
"self",
",",
"caption",
"=",
"'Save all figures'",
",",
"basedir",
"=",
"getcwd_or_home",
"(",
")",... | Save all the figures to a file. | [
"Save",
"all",
"the",
"figures",
"to",
"a",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L573-L580 |
31,521 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_all_figures_todir | def save_all_figures_todir(self, dirname):
"""Save all figure in dirname."""
fignames = []
for thumbnail in self._thumbnails:
fig = thumbnail.canvas.fig
fmt = thumbnail.canvas.fmt
fext = {'image/png': '.png',
'image/jpeg': '.jpg',
... | python | def save_all_figures_todir(self, dirname):
"""Save all figure in dirname."""
fignames = []
for thumbnail in self._thumbnails:
fig = thumbnail.canvas.fig
fmt = thumbnail.canvas.fmt
fext = {'image/png': '.png',
'image/jpeg': '.jpg',
... | [
"def",
"save_all_figures_todir",
"(",
"self",
",",
"dirname",
")",
":",
"fignames",
"=",
"[",
"]",
"for",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"fig",
"=",
"thumbnail",
".",
"canvas",
".",
"fig",
"fmt",
"=",
"thumbnail",
".",
"canvas",
".",... | Save all figure in dirname. | [
"Save",
"all",
"figure",
"in",
"dirname",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L582-L595 |
31,522 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_current_figure_as | def save_current_figure_as(self):
"""Save the currently selected figure."""
if self.current_thumbnail is not None:
self.save_figure_as(self.current_thumbnail.canvas.fig,
self.current_thumbnail.canvas.fmt) | python | def save_current_figure_as(self):
"""Save the currently selected figure."""
if self.current_thumbnail is not None:
self.save_figure_as(self.current_thumbnail.canvas.fig,
self.current_thumbnail.canvas.fmt) | [
"def",
"save_current_figure_as",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"self",
".",
"save_figure_as",
"(",
"self",
".",
"current_thumbnail",
".",
"canvas",
".",
"fig",
",",
"self",
".",
"current_thumbnail",
... | Save the currently selected figure. | [
"Save",
"the",
"currently",
"selected",
"figure",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L597-L601 |
31,523 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_figure_as | def save_figure_as(self, fig, fmt):
"""Save the figure to a file."""
fext, ffilt = {
'image/png': ('.png', 'PNG (*.png)'),
'image/jpeg': ('.jpg', 'JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)'),
'image/svg+xml': ('.svg', 'SVG (*.svg);;PNG (*.png)')}[fmt]
figname = get_un... | python | def save_figure_as(self, fig, fmt):
"""Save the figure to a file."""
fext, ffilt = {
'image/png': ('.png', 'PNG (*.png)'),
'image/jpeg': ('.jpg', 'JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)'),
'image/svg+xml': ('.svg', 'SVG (*.svg);;PNG (*.png)')}[fmt]
figname = get_un... | [
"def",
"save_figure_as",
"(",
"self",
",",
"fig",
",",
"fmt",
")",
":",
"fext",
",",
"ffilt",
"=",
"{",
"'image/png'",
":",
"(",
"'.png'",
",",
"'PNG (*.png)'",
")",
",",
"'image/jpeg'",
":",
"(",
"'.jpg'",
",",
"'JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)'",
")",
"... | Save the figure to a file. | [
"Save",
"the",
"figure",
"to",
"a",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L603-L620 |
31,524 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.remove_all_thumbnails | def remove_all_thumbnails(self):
"""Remove all thumbnails."""
for thumbnail in self._thumbnails:
self.layout().removeWidget(thumbnail)
thumbnail.sig_canvas_clicked.disconnect()
thumbnail.sig_remove_figure.disconnect()
thumbnail.sig_save_figure.disconnect()... | python | def remove_all_thumbnails(self):
"""Remove all thumbnails."""
for thumbnail in self._thumbnails:
self.layout().removeWidget(thumbnail)
thumbnail.sig_canvas_clicked.disconnect()
thumbnail.sig_remove_figure.disconnect()
thumbnail.sig_save_figure.disconnect()... | [
"def",
"remove_all_thumbnails",
"(",
"self",
")",
":",
"for",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"self",
".",
"layout",
"(",
")",
".",
"removeWidget",
"(",
"thumbnail",
")",
"thumbnail",
".",
"sig_canvas_clicked",
".",
"disconnect",
"(",
")"... | Remove all thumbnails. | [
"Remove",
"all",
"thumbnails",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L656-L666 |
31,525 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.remove_thumbnail | def remove_thumbnail(self, thumbnail):
"""Remove thumbnail."""
if thumbnail in self._thumbnails:
index = self._thumbnails.index(thumbnail)
self._thumbnails.remove(thumbnail)
self.layout().removeWidget(thumbnail)
thumbnail.deleteLater()
thumbnail.sig_canvas... | python | def remove_thumbnail(self, thumbnail):
"""Remove thumbnail."""
if thumbnail in self._thumbnails:
index = self._thumbnails.index(thumbnail)
self._thumbnails.remove(thumbnail)
self.layout().removeWidget(thumbnail)
thumbnail.deleteLater()
thumbnail.sig_canvas... | [
"def",
"remove_thumbnail",
"(",
"self",
",",
"thumbnail",
")",
":",
"if",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"thumbnail",
")",
"self",
".",
"_thumbnails",
".",
"remove",
"(",
"... | Remove thumbnail. | [
"Remove",
"thumbnail",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L668-L685 |
31,526 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.set_current_thumbnail | def set_current_thumbnail(self, thumbnail):
"""Set the currently selected thumbnail."""
self.current_thumbnail = thumbnail
self.figure_viewer.load_figure(
thumbnail.canvas.fig, thumbnail.canvas.fmt)
for thumbnail in self._thumbnails:
thumbnail.highlight_canvas... | python | def set_current_thumbnail(self, thumbnail):
"""Set the currently selected thumbnail."""
self.current_thumbnail = thumbnail
self.figure_viewer.load_figure(
thumbnail.canvas.fig, thumbnail.canvas.fmt)
for thumbnail in self._thumbnails:
thumbnail.highlight_canvas... | [
"def",
"set_current_thumbnail",
"(",
"self",
",",
"thumbnail",
")",
":",
"self",
".",
"current_thumbnail",
"=",
"thumbnail",
"self",
".",
"figure_viewer",
".",
"load_figure",
"(",
"thumbnail",
".",
"canvas",
".",
"fig",
",",
"thumbnail",
".",
"canvas",
".",
... | Set the currently selected thumbnail. | [
"Set",
"the",
"currently",
"selected",
"thumbnail",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L698-L704 |
31,527 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.go_previous_thumbnail | def go_previous_thumbnail(self):
"""Select the thumbnail previous to the currently selected one."""
if self.current_thumbnail is not None:
index = self._thumbnails.index(self.current_thumbnail) - 1
index = index if index >= 0 else len(self._thumbnails) - 1
self.set_cu... | python | def go_previous_thumbnail(self):
"""Select the thumbnail previous to the currently selected one."""
if self.current_thumbnail is not None:
index = self._thumbnails.index(self.current_thumbnail) - 1
index = index if index >= 0 else len(self._thumbnails) - 1
self.set_cu... | [
"def",
"go_previous_thumbnail",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"self",
".",
"current_thumbnail",
")",
"-",
"1",
"index",
"=",
"index",
... | Select the thumbnail previous to the currently selected one. | [
"Select",
"the",
"thumbnail",
"previous",
"to",
"the",
"currently",
"selected",
"one",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L706-L712 |
31,528 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.go_next_thumbnail | def go_next_thumbnail(self):
"""Select thumbnail next to the currently selected one."""
if self.current_thumbnail is not None:
index = self._thumbnails.index(self.current_thumbnail) + 1
index = 0 if index >= len(self._thumbnails) else index
self.set_current_index(inde... | python | def go_next_thumbnail(self):
"""Select thumbnail next to the currently selected one."""
if self.current_thumbnail is not None:
index = self._thumbnails.index(self.current_thumbnail) + 1
index = 0 if index >= len(self._thumbnails) else index
self.set_current_index(inde... | [
"def",
"go_next_thumbnail",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"self",
".",
"current_thumbnail",
")",
"+",
"1",
"index",
"=",
"0",
"if",
... | Select thumbnail next to the currently selected one. | [
"Select",
"thumbnail",
"next",
"to",
"the",
"currently",
"selected",
"one",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L714-L720 |
31,529 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.scroll_to_item | def scroll_to_item(self, index):
"""Scroll to the selected item of ThumbnailScrollBar."""
spacing_between_items = self.scene.verticalSpacing()
height_view = self.scrollarea.viewport().height()
height_item = self.scene.itemAt(index).sizeHint().height()
height_view_excluding_item =... | python | def scroll_to_item(self, index):
"""Scroll to the selected item of ThumbnailScrollBar."""
spacing_between_items = self.scene.verticalSpacing()
height_view = self.scrollarea.viewport().height()
height_item = self.scene.itemAt(index).sizeHint().height()
height_view_excluding_item =... | [
"def",
"scroll_to_item",
"(",
"self",
",",
"index",
")",
":",
"spacing_between_items",
"=",
"self",
".",
"scene",
".",
"verticalSpacing",
"(",
")",
"height_view",
"=",
"self",
".",
"scrollarea",
".",
"viewport",
"(",
")",
".",
"height",
"(",
")",
"height_i... | Scroll to the selected item of ThumbnailScrollBar. | [
"Scroll",
"to",
"the",
"selected",
"item",
"of",
"ThumbnailScrollBar",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L722-L738 |
31,530 | spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.go_up | def go_up(self):
"""Scroll the scrollbar of the scrollarea up by a single step."""
vsb = self.scrollarea.verticalScrollBar()
vsb.setValue(int(vsb.value() - vsb.singleStep())) | python | def go_up(self):
"""Scroll the scrollbar of the scrollarea up by a single step."""
vsb = self.scrollarea.verticalScrollBar()
vsb.setValue(int(vsb.value() - vsb.singleStep())) | [
"def",
"go_up",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"scrollarea",
".",
"verticalScrollBar",
"(",
")",
"vsb",
".",
"setValue",
"(",
"int",
"(",
"vsb",
".",
"value",
"(",
")",
"-",
"vsb",
".",
"singleStep",
"(",
")",
")",
")"
] | Scroll the scrollbar of the scrollarea up by a single step. | [
"Scroll",
"the",
"scrollbar",
"of",
"the",
"scrollarea",
"up",
"by",
"a",
"single",
"step",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L741-L744 |
31,531 | 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 |
31,532 | 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 |
31,533 | 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 |
31,534 | 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 |
31,535 | 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 |
31,536 | 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 |
31,537 | 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 |
31,538 | 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 |
31,539 | 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 |
31,540 | 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 |
31,541 | 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 |
31,542 | 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 |
31,543 | 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 |
31,544 | 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 |
31,545 | 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 |
31,546 | 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 |
31,547 | 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 |
31,548 | 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 |
31,549 | 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 |
31,550 | 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 |
31,551 | 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 |
31,552 | 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 |
31,553 | 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 |
31,554 | 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 |
31,555 | 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 |
31,556 | 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 |
31,557 | 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 |
31,558 | 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 |
31,559 | 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 |
31,560 | 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 |
31,561 | 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 |
31,562 | 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 |
31,563 | 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 |
31,564 | 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 |
31,565 | 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 |
31,566 | 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 |
31,567 | 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 |
31,568 | 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 |
31,569 | 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 |
31,570 | 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 |
31,571 | 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 |
31,572 | 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 |
31,573 | 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 |
31,574 | 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 |
31,575 | 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 |
31,576 | 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 |
31,577 | 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 |
31,578 | 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 |
31,579 | 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 |
31,580 | 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 |
31,581 | 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 |
31,582 | 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 |
31,583 | 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 |
31,584 | 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 |
31,585 | 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 |
31,586 | 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 |
31,587 | 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 |
31,588 | 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 |
31,589 | 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 |
31,590 | 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 |
31,591 | 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 |
31,592 | 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 |
31,593 | 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 |
31,594 | 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 |
31,595 | 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 |
31,596 | 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 |
31,597 | 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 |
31,598 | 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 |
31,599 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.