text
stringlengths
0
828
return strong"
212,"def save(self, hdf5):
""""""Saves this cascade into the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for writing
""""""
# write the cascade to file
hdf5.set(""Thresholds"", self.thresholds)
for i in range(len(self.cascade)):
hdf5.create_group(""Classifier_%d"" % (i+1))
hdf5.cd(""Classifier_%d"" % (i+1))
self.cascade[i].save(hdf5)
hdf5.cd("".."")
hdf5.create_group(""FeatureExtractor"")
hdf5.cd(""FeatureExtractor"")
self.extractor.save(hdf5)
hdf5.cd("".."")"
213,"def load(self, hdf5):
""""""Loads this cascade from the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for reading
""""""
# write the cascade to file
self.thresholds = hdf5.read(""Thresholds"")
self.cascade = []
for i in range(len(self.thresholds)):
hdf5.cd(""Classifier_%d"" % (i+1))
self.cascade.append(bob.learn.boosting.BoostedMachine(hdf5))
hdf5.cd("".."")
hdf5.cd(""FeatureExtractor"")
self.extractor = FeatureExtractor(hdf5)
hdf5.cd("".."")
self._indices()"
214,"def check(ctx, repository, config):
""""""Check commits.""""""
ctx.obj = Repo(repository=repository, config=config)"
215,"def message(obj, commit='HEAD', skip_merge_commits=False):
""""""Check the messages of the commits.""""""
from ..kwalitee import check_message
options = obj.options
repository = obj.repository
if options.get('colors') is not False:
colorama.init(autoreset=True)
reset = colorama.Style.RESET_ALL
yellow = colorama.Fore.YELLOW
green = colorama.Fore.GREEN
red = colorama.Fore.RED
else:
reset = yellow = green = red = ''
try:
sha = 'oid'
commits = _pygit2_commits(commit, repository)
except ImportError:
try:
sha = 'hexsha'
commits = _git_commits(commit, repository)
except ImportError:
click.echo('To use this feature, please install pygit2. '
'GitPython will also work but is not recommended '
'(python <= 2.7 only).',
file=sys.stderr)
return 2
template = '{0}commit {{commit.{1}}}{2}\n\n'.format(yellow, sha, reset)
template += '{message}{errors}'
count = 0
ident = ' '
re_line = re.compile('^', re.MULTILINE)
for commit in commits:
if skip_merge_commits and _is_merge_commit(commit):
continue
message = commit.message
errors = check_message(message, **options)
message = re.sub(re_line, ident, message)
if errors:
count += 1
errors.insert(0, red)
else:
errors = [green, 'Everything is OK.']
errors.append(reset)
click.echo(template.format(commit=commit,
message=message.encode('utf-8'),
errors='\n'.join(errors)))
if min(count, 1):
raise click.Abort"
216,"def files(obj, commit='HEAD', skip_merge_commits=False):
""""""Check the files of the commits.""""""
from ..kwalitee import check_file, SUPPORTED_FILES
from ..hooks import run