Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def toggled_item(self, data, row):
rc = True
if self.clickCB:
rc = self.clickCB(data, row)
if rc:
checklist.CheckList.toggled_item(self, data, row)
import checklist
import datacombo
import math
from pyanaconda import iutil
from pyanaconda.constants import *
from pyanaconda.partIntfHelpers import *
from pyanaconda.storage.formats import *
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
FLAG_FORMAT = 1
FLAG_MIGRATE = 2
class WideCheckList(checklist.CheckList):
def toggled_item(self, data, row):
rc = True
if self.clickCB:
rc = self.clickCB(data, row)
if rc:
checklist.CheckList.toggled_item(self, data, row)
def __init__(self, columns, store, clickCB=None, sensitivity=False):
checklist.CheckList.__init__(self, columns=columns,
custom_store=store,
sensitivity=sensitivity)
# make checkbox column wider
sep = gtk.HSeparator ()
vbox.pack_start (sep, False, 15)
label = gui.MnemonicLabel(_("Select _additional languages to install "
"on the system:"))
label.set_alignment (0.0, 0.5)
label.set_line_wrap (True)
label.set_size_request(400, -1)
vbox.pack_start (label, False)
hbox = gtk.HBox (False, 5)
# langs we want to support
self.languageList = checklist.CheckList(1)
label.set_mnemonic_widget(self.languageList)
self.maxrows = 0
list = []
for locale in self.languages:
if locale == self.defaultLang or (locale in self.supportedLangs):
self.languageList.append_row((locale, ""), True)
list.append(locale)
else:
self.languageList.append_row((locale, ""), False)
self.maxrows = self.maxrows + 1
self.setCurrent(self.defaultLang)
self.table = gtk.Table (2, 8)
box.pack_start (self.table, False, 5)
y = 0
label = gui.WrappingLabel (_("You can use a firewall to allow "
"access to specific services on your "
"computer from other computers. Which "
"services, if any, do you wish to "
"allow access to ?"))
label.set_size_request(400, -1)
label.set_alignment(0.0, 0.0)
self.table.attach(label, 0, 2, y, y + 1, gtk.EXPAND | gtk.FILL, gtk.FILL, 5, 5)
y = y + 1
hbox = gtk.HBox(False, 10)
self.incoming = checklist.CheckList(1)
self.incoming.set_size_request(-1, 125)
incomingSW = gtk.ScrolledWindow()
incomingSW.set_border_width(5)
incomingSW.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
incomingSW.set_shadow_type(gtk.SHADOW_IN)
incomingSW.add(self.incoming)
for serv in self.firewall.services:
self.incoming.append_row ( (_(serv.get_name()), serv),
serv.get_enabled() )
self.table.attach (incomingSW, 0, 2, y, y + 1, gtk.EXPAND|gtk.FILL, gtk.FILL, 5, 5)
if self.firewall.enabled == 0:
self.disabled_radio.set_active (True)
def __init__(self, columns, store, clickCB=None, sensitivity=False):
checklist.CheckList.__init__(self, columns=columns,
custom_store=store,
sensitivity=sensitivity)
# make checkbox column wider
column = self.get_column(columns)
self.set_expander_column(column)
column = self.get_column(0)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(25)
self.clickCB = clickCB
import gtk
import checklist
import datacombo
import iutil
from constants import *
from partIntfHelpers import *
from storage.formats import *
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
FLAG_FORMAT = 1
FLAG_MIGRATE = 2
class WideCheckList(checklist.CheckList):
def toggled_item(self, data, row):
rc = True
if self.clickCB:
rc = self.clickCB(data, row)
if rc:
checklist.CheckList.toggled_item(self, data, row)
def __init__(self, columns, store, clickCB=None, sensitivity=False):
checklist.CheckList.__init__(self, columns=columns,
custom_store=store,
sensitivity=sensitivity)
# make checkbox column wider
def _validate(self, root, dirs, files):
# If any of the directories yet to be visited should be skipped, remove
# them from ``dirs`` so that we don't visit them in a future iteration.
# This guarantees that ``root`` is a valid directory that should not be
# skipped (since we're doing a top-down walk).
for skip_dir in self.skip_dirs:
if skip_dir in dirs:
dirs.remove(skip_dir)
invalid_dirs = []
if '__init__.py' not in files:
invalid_dirs.append(root)
return invalid_dirs
class ExecPermissionValidator(RepoValidator):
"""Flag code files that have execute permissions.
Parameters
----------
extensions : iterable of str, optional
File extensions of files to validate. Defaults to Python, Cython, and
C files (header and source files).
"""
reason = "Library code with execute permissions:"
def __init__(self, extensions=None):
if extensions is None:
extensions = {'.py', '.pyx', '.h', '.c'}
self.extensions = set(extensions)
This code was taken from verman's
``verman.Version.verman_system_call``. See licenses/verman.txt and
https://github.com/biocore/verman for more details.
"""
proc = subprocess.Popen(cmd, shell=True, universal_newlines=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# communicate pulls all stdout/stderr from the PIPEs to
# avoid blocking -- don't remove this line!
stdout, stderr = proc.communicate()
return_value = proc.returncode
return stdout, stderr, return_value
class CopyrightHeadersValidator(RepoValidator):
"""Flag library files with non-standard copyright headers
See the current standard for scikit-bio's copyright headers at
``http://scikit-bio.org/docs/latest/development/new_module.html``
Individual files are ignored if the first line in the file is exactly:
# checklist.py:CopyrightHeadersValidator IGNORE
If a file is ignored, a ``ChecklistWarning`` is raised.
Parameters
----------
skip_dirs : iterable of str, optional
Directory names to skip during validation. Defaults to skipping any
directories named ``'data'`` or ``'__pycache__'`` (and anything
if tokens[pos][0] == tokenize.STRING:
pos += 3
# copyright header consists of 7 lines, and by discussion in
# preceding comment, spans through 14 tokens.
cheader = ''.join(map(lambda x: x[1], tokens[pos:pos + 14]))
# Ensure that there is no blank line at the end of the file
if (cheader != self.COPYRIGHT_HEADER or
(tokens[pos + 14][0] != tokenize.NL and
tokens[pos + 14][0] != tokenize.ENDMARKER)):
invalid_files.append(f.name)
f.close()
return invalid_files
class InitValidator(RepoValidator):
"""Flag library code directories that are missing init files.
This type of validation is important mainly because it is very easy to
forget to add an __init__.py file to a new test directory. If this
happens, nose will skip those tests unless it is run from the root of the
source repository. Thus, the tests will be skipped if the package is
pip-installed, e.g., as an end-user might install a release.
Parameters
----------
skip_dirs : iterable of str, optional
Directory names to skip during validation. Defaults to skipping any
directories named ``'data'`` or ``'__pycache__'`` (and anything
contained within them).
"""
Returns
-------
list of str
List of filepaths or dirpaths to be considered invalid (i.e., that
did not pass the validation checks).
See Also
--------
os.walk
"""
raise NotImplementedError("Subclasses must implement _validate.")
class InitValidator(RepoValidator):
"""Flag library code directories that are missing init files.
This type of validation is important mainly because it is very easy to
forget to add an __init__.py file to a new test directory. If this
happens, nose will skip those tests unless it is run from the root of the
source repository. Thus, the tests will be skipped if the package is
pip-installed, e.g., as an end-user might install a release.
Parameters
----------
skip_dirs : iterable of str, optional
Directory names to skip during validation. Defaults to skipping any
directories named ``'data'`` or ``'__pycache__'`` (and anything
contained within them).
"""