Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def toggle_pdb_execute_events(self, checked):
""""Set pdb_execute_events"""
CONF.set('run', 'pdb_execute_events', checked)
self.main.ipyconsole.set_pdb_execute_events()
def toggle_pdb_ignore_lib(self, checked):
""""Set pdb_ignore_lib"""
CONF.set('run', 'pdb_ignore_lib', checked)
self.main.ipyconsole.set_pdb_ignore_lib()
def set_font(font, section='appearance', option='font'):
"""Set font"""
CONF.set(section, option+'/family', to_text_string(font.family()))
CONF.set(section, option+'/size', float(font.pointSize()))
CONF.set(section, option+'/italic', int(font.italic()))
CONF.set(section, option+'/bold', int(font.bold()))
FONT_CACHE[(section, option)] = font
def set_font(font, section='appearance', option='font'):
"""Set font"""
CONF.set(section, option+'/family', to_text_string(font.family()))
CONF.set(section, option+'/size', float(font.pointSize()))
CONF.set(section, option+'/italic', int(font.italic()))
CONF.set(section, option+'/bold', int(font.bold()))
FONT_CACHE[(section, option)] = font
to update the changes in each editorstack.
conf_name (str): configuration setting associated with the
action.
"""
if method_name:
if self.editorstacks:
for editorstack in self.editorstacks:
try:
method = getattr(editorstack, method_name)
method(checked)
except AttributeError as e:
logger.error(e, exc_info=True)
self.set_option(conf_name, checked)
else:
if conf_name in ('pycodestyle', 'pydocstyle'):
CONF.set('lsp-server', conf_name, checked)
completions = self.main.completions
completions.update_configuration()
"""Store credentials for future use."""
if username and password and remember:
CONF.set('main', 'report_error/username', username)
try:
keyring.set_password('github', username, password)
except Exception:
if self._show_msgbox:
QMessageBox.warning(self.parent_widget,
_('Failed to store password'),
_('It was not possible to securely '
'save your password. You will be '
'prompted for your Github '
'credentials next time you want '
'to report an issue.'))
remember = False
CONF.set('main', 'report_error/remember_me', remember)
def set_color_scheme(name, color_scheme, replace=True):
"""Set syntax color scheme"""
section = "appearance"
names = CONF.get("appearance", "names", [])
for key in sh.COLOR_SCHEME_KEYS:
option = "%s/%s" % (name, key)
value = CONF.get(section, option, default=None)
if value is None or replace or name not in names:
CONF.set(section, option, color_scheme[key])
names.append(to_text_string(name))
CONF.set(section, "names", sorted(list(set(names))))
default_interpreter = CONF.get('main_interpreter', 'default')
pypath = add_pathlist_to_PYTHONPATH([], pathlist, ipyconsole=True,
drop_env=False)
# Environment variables that we need to pass to our sitecustomize
umr_namelist = CONF.get('main_interpreter', 'umr/namelist')
if PY2:
original_list = umr_namelist[:]
for umr_n in umr_namelist:
try:
umr_n.encode('utf-8')
except UnicodeDecodeError:
umr_namelist.remove(umr_n)
if original_list != umr_namelist:
CONF.set('main_interpreter', 'umr/namelist', umr_namelist)
env_vars = {
'SPY_EXTERNAL_INTERPRETER': not default_interpreter,
'SPY_UMR_ENABLED': CONF.get('main_interpreter', 'umr/enabled'),
'SPY_UMR_VERBOSE': CONF.get('main_interpreter', 'umr/verbose'),
'SPY_UMR_NAMELIST': ','.join(umr_namelist),
'SPY_RUN_LINES_O': CONF.get('ipython_console', 'startup/run_lines'),
'SPY_PYLAB_O': CONF.get('ipython_console', 'pylab'),
'SPY_BACKEND_O': CONF.get('ipython_console', 'pylab/backend'),
'SPY_AUTOLOAD_PYLAB_O': CONF.get('ipython_console',
'pylab/autoload'),
'SPY_FORMAT_O': CONF.get('ipython_console',
'pylab/inline/figure_format'),
'SPY_BBOX_INCHES_O': CONF.get('ipython_console',
'pylab/inline/bbox_inches'),
'SPY_RESOLUTION_O': CONF.get('ipython_console',
if warning:
box = MessageCheckBox(icon=QMessageBox.Warning, parent=self)
box.setWindowTitle(reset_str)
box.set_checkbox_text(_("Don't show again."))
box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
box.setDefaultButton(QMessageBox.Yes)
box.set_checked(False)
box.set_check_visible(True)
box.setText(warn_str)
answer = box.exec_()
# Update checkbox based on user interaction
CONF.set('ipython_console', 'show_reset_namespace_warning',
not box.is_checked())
self.ipyclient.reset_warning = not box.is_checked()
if answer != QMessageBox.Yes:
return
try:
if self.is_waiting_pdb_input():
self.dbg_exec_magic('reset', '-f')
else:
if message:
self.reset()
self._append_html(_("<br><br>Removing all variables..."
"\n<hr>"),
before_prompt=False)
self.silent_execute("%reset -f")