Get hook information declared by Module Builder.

This invokes our own hook, hook_module_builder_info(), as well as adding
hardcoded info such as module file locations, which can't be deduced from
either api.php files or hook_hook_info().
979459
protected function getHookInfo() {
    // Get data by invoking our hook.
    $data = \DrupalCodeBuilder\Factory::getEnvironment()->invokeInfoHook();

    // Add our data.
    $result = $this->getAdditionalHookInfo();
    $data = array_merge($data, $result);

    return $data;
  }
797830
def _info(self):
        
        name = self.__class__.__module__ + '.' + self.__class__.__name__
        info, created = ModuleInfo.objects.get_or_create(name=name)
        if created:
            # Do not set as changed
            info.commit()
        return info
392391
def get_enabled_hook_plugins(self, hook, args, **kwargs):
        
        manager = self.hook_managers[hook]
        if len(list(manager)) == 0:
            return []
        return [
            plugin for plugin in manager.map(
                self._create_hook_plugin, args, **kwargs)
            if plugin is not None
        ]
1163866
def register_all_hooks():
    
    global _all_hooks_registered
    if not _all_hooks_registered:
        logger.debug("Searching for hooks")
        hooks = list(get_app_submodules('auth_hooks'))
        logger.debug("Got %s hooks" % len(hooks))
        _all_hooks_registered = True
1172391
def method_added(method_name)
      # do nothing if the method that was added was an actual hook method, or
      # if it already had hooks added to it
      return if hooks.include?(method_name) || hooked_methods.include?(method_name)
      add_hooks_to(method_name)
    end
749038
public function getModuleHooks($module)
    {
        $hooks = $this->getHooksDefinitionsFromSugar($module);
        if (empty($hooks)) {
            return array();
        }

        $sortedHooks = array();
        $hooksDef = $this->getHooksDefinitionsFromFiles($module);

        // Process hooks in a specific order
        foreach ($this->modulesLogicHooksDef as $type => $hookDesc) {
            if (!array_key_exists($type, $hooks) || empty($hooks[$type])) {
                continue;
            }

            $i = 0;
            foreach ($hooks[$type] as $hook) {
                $num = str_pad($hook[0], 20, 0, \STR_PAD_LEFT) . '_' . $i;
                $sortedHooks[$type][$num] = array(
                    'Weight' => $hook[0],
                    'Description' => $hook[1],
                    'File' => $hook[2],
                    'Class' => $hook[3],
                    'Method' => $hook[4],
                    'Defined In' => $this->findHookInDefinition($hooksDef, $type, $hook[2], $hook[3], $hook[4]),
                );
                $i++;
            }
            ksort($sortedHooks[$type]);
            unset($hooks[$type]);
        }

        // Have I lost some hooks ?
        if (!empty($hooks)) {
            foreach ($hooks as $type => $hooks) {
                foreach ($hooks as $hook) {
                    if (empty($hook)) {
                        continue;
                    }
                    $sortedHooks[$type][] = array(
                        'Weight' => $hook[0],
                        'Description' => $hook[1],
                        'File' => $hook[2],
                        'Class' => $hook[3],
                        'Method' => $hook[4],
                        'Defined In' => $this->findHookInDefinition($hooksDef, $type, $hook[2], $hook[3], $hook[4]),
                    );
                }
            }
        }

        return $sortedHooks;
    }
382922
def hook_output (module:nn.Module, detach:bool=True, grad:bool=False)->Hook:
    ""
    return Hook(module, _hook_inner, detach=detach, is_forward=not grad)
1150603
public function getFileInfo() {
    // Create a build list tag from the filename.
    $filename_pieces = explode('.', $this->component_data['filename']);
    if ($filename_pieces[0] == '%module') {
      // Take off the module name from the front.
      array_shift($filename_pieces);
    }
    if (in_array(end($filename_pieces), ['php', 'inc'])) {
      // Take off a file extenstion.
      array_pop($filename_pieces);
    }
    // Implode whatever's left.
    $file_key_tag = implode('.', $filename_pieces);

    return array(
      'path' => '', // Means base folder.
      'filename' => $this->component_data['filename'],
      'body' => $this->fileContents(),
      'build_list_tags' => ['code', $file_key_tag],
    );
  }
779611
def hooks(ctx):
    
    from ..hooks.run_hooks_hook import RunHooksHook

    bundles = _get_bundles(ctx.obj.data['env'])
    hooks = RunHooksHook(None).collect_from_bundles(bundles)
    print_table(('Hook Name',
                 'Default Bundle Module',
                 'Bundle Module Override Attr',
                 'Description'),
                [(hook.name,
                 hook.bundle_module_name or '(None)',
                 hook.bundle_override_module_name_attr or '(None)',
                 format_docstring(hook.__doc__) or '(None)') for hook in hooks])
538749
public static function register($hook, $id_module)
    {
        $Hook =  self::isRegistered($hook);
        if (!$Hook)
        {
            // first register hook in database
            $Hook = new Hook();
            $Hook->name = $hook;
            if (!$Hook->save())
            {
                \Log::info($Hook->errors());
                return false;
            }
        }
        return $Hook->registerModule($id_module);

    }
810594
public void info( String oinfo ) {
		//
		String methodName = moduleCode + "." + "info";
		//
		out.format( "%s%n", oinfo );
		//
		charsCount += oinfo.length();
		//
		String FOInfo = getFullInfoString( oinfo );
		//
		if ( !isFileOpen( methodName ) ) return;
		//
		outFile( FOInfo );
		//
        flushFile();
		//
	}
871
def generate_module_table_header(modules):
    

    # Print header file for all external modules.
    mod_defs = []
    print("// Automatically generated by makemoduledefs.py.\n")
    for module_name, obj_module, enabled_define in modules:
        mod_def = "MODULE_DEF_{}".format(module_name.upper())
        mod_defs.append(mod_def)
        print((
            "#if ({enabled_define})\n"
            "    extern const struct _mp_obj_module_t {obj_module};\n"
            "    #define {mod_def} {{ MP_ROM_QSTR({module_name}), MP_ROM_PTR(&{obj_module}) }},\n"
            "#else\n"
            "    #define {mod_def}\n"
            "#endif\n"
            ).format(module_name=module_name, obj_module=obj_module,
                     enabled_define=enabled_define, mod_def=mod_def)
        )

    print("\n#define MICROPY_REGISTERED_MODULES \\")

    for mod_def in mod_defs:
        print("    {mod_def} \\".format(mod_def=mod_def))

    print("// MICROPY_REGISTERED_MODULES")
719532
def get_modules_info():
    """"""
    module_infos = []
    for (mod, name, version_attr) in Modules:
        if not fileutil.has_module(mod):
            continue
        if hasattr(mod, version_attr):
            attr = getattr(mod, version_attr)
            version = attr() if callable(attr) else attr
            module_infos.append("%s %s" % (name, version))
        else:
            # ignore attribute errors in case library developers
            # change the version information attribute
            module_infos.append(name)
    return u"Modules: %s" % (u", ".join(module_infos))
496264
function getHtmlWebpackPluginHooks (compilation) {
  let hooks = htmlWebpackPluginHooksMap.get(compilation);
  // Setup the hooks only once
  if (hooks === undefined) {
    hooks = createHtmlWebpackPluginHooks();
    htmlWebpackPluginHooksMap.set(compilation, hooks);
  }
  return hooks;
}
544807
function() {

    var hookPath = path.resolve(this.options.dest, this.hookName);

    var existingCode = this.getHookContent(hookPath);

    if (existingCode) {
      this.validateScriptLanguage(existingCode);
    }

    var hookContent;
    if(this.hasMarkers(existingCode)) {
      hookContent = this.insertBindingCode(existingCode);
    } else {
      hookContent = this.appendBindingCode(existingCode);
    }

    fs.writeFileSync(hookPath, hookContent);

    fs.chmodSync(hookPath, '755');
  }
1288941
def hook_outputs(modules:Collection[nn.Module], detach:bool=True, grad:bool=False)->Hooks:
    ""
    return Hooks(modules, _hook_inner, detach=detach, is_forward=not grad)
1108485
def _GetOutputModulesInformation(self):
    
    output_modules_information = []
    for name, output_class in output_manager.OutputManager.GetOutputClasses():
      output_modules_information.append((name, output_class.DESCRIPTION))

    return output_modules_information