Install the hooks configured in glerbl.conf.py.
519545
def _install(_):
    
    if not os.path.exists(".git"):
        fatal("not in a git repo.")

    config = __load_config()

    if config.get("checks") is None:
        fatal("global ``checks`` variable missing from configuration.")

    # We try to load all checks to check that they exist NOW.
    for hook in config["checks"]:
        checks = __load_checks(config["checks"][hook])
        # Also verify that they apply to the hooks.
        __verify_checks_for_hook(checks, hook)

    reply = input("This will overwrite your current hooks. "
                  "Proceed [yes/No]? ")
    if reply != "yes":
        raise Exit(0)

    for hook in config["checks"]:
        hook_f = open(os.path.join(".git/hooks/", hook), 'w')
        hook_f.write("""#!/usr/bin/env python
# GENRATED BY GLERBL. DO NOT MODIFY.
from glerbl.__main__ import main


exit(main(["glerbl", "hook", "{0}"]))
""".format(hook))
        os.fchmod(hook_f.fileno(),
                  os.fstat(hook_f.fileno()).st_mode | stat.S_IXUSR)
        hook_f.close()
508231
def install(self):
        """"""
        self.distro = distro_check()
        package_list = self.packages_dict.get(self.distro)
        self._installer(package_list=package_list.get('packages'))
480864
public function boot()
    {
        $finder = $this->app->make('orchestra.extension.finder');

        foreach ($this->extensions as $name => $path) {
            if (\is_numeric($name)) {
                $finder->addPath($path);
            } else {
                $finder->registerExtension($name, $path);
            }
        }
    }
517459
def install_sql_hook():
    # type: () -> None
    """"""
    try:
        from django.db.backends.utils import CursorWrapper  # type: ignore
    except ImportError:
        from django.db.backends.util import CursorWrapper  # type: ignore

    try:
        real_execute = CursorWrapper.execute
        real_executemany = CursorWrapper.executemany
    except AttributeError:
        # This won't work on Django versions < 1.6
        return

    def record_many_sql(sql, param_list, cursor):
        for params in param_list:
            record_sql(sql, params, cursor)

    def execute(self, sql, params=None):
        try:
            return real_execute(self, sql, params)
        finally:
            record_sql(sql, params, self.cursor)

    def executemany(self, sql, param_list):
        try:
            return real_executemany(self, sql, param_list)
        finally:
            record_many_sql(sql, param_list, self.cursor)

    CursorWrapper.execute = execute
    CursorWrapper.executemany = executemany
    ignore_logger("django.db.backends")
740886
def run(self):
        """"""
        install.run(self)

        #
        # Remove old pygubu.py from scripts path if exists
        spath = os.path.join(self.install_scripts, 'pygubu')
        for ext in ('.py', '.pyw'):
            filename = spath + ext
            if os.path.exists(filename):
                os.remove(filename)
        #
        # Remove old pygubu-designer.bat
        if platform.system() == 'Windows':
            spath = os.path.join(self.install_scripts, 'pygubu-designer.bat')
            if os.path.exists(spath):
                os.remove(spath)
781490
def setup(self, name_filters=['*.py', '*.pyw'], show_all=False,
              single_click_to_open=False):
        """"""
        self.setup_view()

        self.set_name_filters(name_filters)
        self.show_all = show_all
        self.single_click_to_open = single_click_to_open
        
        # Setup context menu
        self.menu = QMenu(self)
        self.common_actions = self.setup_common_actions()
1112622
def hook(self, name):
        
        def wrapper(func):
            self.hooks.add(name, func)
            return func
        return wrapper
6676
def load_hooks(self, context):
        
        for hook in self.configuration.get('hooks', ()):
            config = hook.get('configuration', {})
            config.update(self.configuration.get('configuration', {}))

            try:
                self._load_hook(hook['name'], config, context)
            except KeyError:
                self.logger.exception('Provided hook has no name: %s.', hook)
1112793
def install(**kwargs):
    """"""
    force = kwargs.get('force')
    preserve_legacy = kwargs.get('preserve_legacy')

    colorama.init(strip=kwargs.get('no_color'))

    stdout = subprocess.check_output('which therapist', shell=True)
    therapist_bin = stdout.decode('utf-8').split()[0]

    git_dir = current_git_dir()

    if git_dir is None:
        output(NOT_GIT_REPO_MSG)
        exit(1)

    hook_options = {
        'fix': '--fix' if kwargs.get('fix') else '',
        'stage_modified_files': '' if kwargs.get('no_stage_modified_files') else '--stage-modified-files',
        'therapist_bin': therapist_bin,
    }

    srchook_path = os.path.join(BASE_DIR, 'hooks', 'pre-commit-template')
    with open(srchook_path, 'r') as f:
        srchook = f.read()
    srchook_hash = hash_hook(srchook_path, hook_options)

    dsthook_path = os.path.join(git_dir, 'hooks', 'pre-commit')

    if os.path.isfile(dsthook_path):
        dsthook_hash = identify_hook(dsthook_path)
        if dsthook_hash:
            if dsthook_hash == srchook_hash:
                output(HOOK_ALREADY_INSTALLED_MSG)
                exit(0)
        else:
            if not force and not preserve_legacy:
                print(EXISTING_HOOK_MSG)
                preserve_legacy = click.confirm(CONFIRM_PRESERVE_LEGACY_HOOK_MSG, default=True)

            if preserve_legacy:
                output(COPYING_HOOK_MSG, end='')
                shutil.copy2(dsthook_path, '{}.legacy'.format(dsthook_path))
                output(DONE_COPYING_HOOK_MSG)
            elif not force:
                if not click.confirm(CONFIRM_REPLACE_HOOK_MSG, default=False):
                    output(INSTALL_ABORTED_MSG)
                    exit(1)

    output(INSTALLING_HOOK_MSG, end='')
    with open(dsthook_path, 'w+') as f:
        srchook = srchook.replace('%hash%', srchook_hash)
        for k, v in iteritems(hook_options):
            srchook = srchook.replace('%{}%'.format(k), v)
        f.write(srchook)
    os.chmod(dsthook_path, 0o775)
    output(DONE_INSTALLING_HOOK_MSG)
150548
def setup(config=None, logfile=None):
        """"""

        if config is None:
            configpath = os.path.join(fermipy.PACKAGE_ROOT, 'config',
                                      'logging.yaml')
            with open(configpath, 'r') as f:
                config = yaml.load(f)

        # Update configuration
        if logfile:
            for name, h in config['handlers'].items():
                if 'file_handler' in name:
                    config['handlers'][name]['filename'] = logfile

        logging.config.dictConfig(config)
1219725
def setup(self, app):
        """"""
        super().setup(app)
        self.cfg.port = int(self.cfg.port)
        self.cfg.db = int(self.cfg.db)
        self.cfg.poolsize = int(self.cfg.poolsize)
1316226
def _run_hooks(self):
        """"""
        for hook in self.hooks:
            getattr(self, hook)(self._state)
210566
def _initialize_plugin_system(self) -> None:
        """"""
        self._preloop_hooks = []
        self._postloop_hooks = []
        self._postparsing_hooks = []
        self._precmd_hooks = []
        self._postcmd_hooks = []
        self._cmdfinalization_hooks = []
1372897
def register_hooks(self, field):
        """"""
        for hook, subhooks in field.register_hooks():
            self.hooks[hook].append(field)
            self.subhooks[hook] |= set(subhooks)
798971
protected function setupFacades()
    {
        // Setup alias loader.
        $loader = AliasLoader::getInstance();

        // Load Sentinel
        // - Activation
        // - Reminder
        // - Sentinel
        $loader->alias('Activation', Activation::class);
        $loader->alias('Reminder', Reminder::class);
        $loader->alias('Sentinel', Sentinel::class);

        // Load Flash
        $loader->alias('Flash', Flash::class);

        // Load Ekko
        $loader->alias('Ekko', Ekko::class);

        // Carbon
        $loader->alias('Carbon', Carbon::class);

        // Load Form
        // - Form
        // - BootForm
        $loader->alias('Form', Form::class);
        $loader->alias('BootForm', BootForm::class);
    }
630605
def run(self):
        """"""
        self._make_lib_file_symbolic_links()
        self._copy_each_include_files_to_include_dir()
        self._make_dep_lib_file_sym_links_and_copy_include_files()
        self.setup_py.add_patchs_to_build_without_pkg_config(
            self.rpm.lib_dir, self.rpm.include_dir
        )
        self.setup_py.apply_and_save()
        self._build_and_install()
353109
def install (self):
        """"""
        outs = super(MyInstallLib, self).install()
        infile = self.create_conf_file()
        outfile = os.path.join(self.install_dir, os.path.basename(infile))
        self.copy_file(infile, outfile)
        outs.append(outfile)
        return outs