Generates a NetworkedConfigObject using the specified hooks.
352293
def GenerateNetworkedConfigFile(load_hook, normal_class_load_hook, normal_class_dump_hook, **kwargs) -> NetworkedConfigObject:
    
    def NetworkedConfigObjectGenerator(url, safe_load: bool=True):
        cfg = NetworkedConfigObject(url=url, load_hook=load_hook, safe_load=safe_load,
                                    normal_class_load_hook=normal_class_load_hook,
                                    normal_class_dump_hook=normal_class_dump_hook)
        return cfg

    return NetworkedConfigObjectGenerator
1191230
def network(name, options = {}, provider = nil)
    plugin(:CORL, :network, provider, Config.ensure(options).import({ :name => name }))
  end
87359
def add_hook(self, key_name, hook_name, hook_dict):
        """"""
        kf = self.dct[key_name]
        if 'hooks' not in kf:
            kf['hooks'] = {}
        kf['hooks'][str(hook_name)] = hook_dict
1363882
function loadConfigAndGenerateSite(useServer, port) {
  var config = loadConfig();
  if (port) config.port = port;
  generateSite(config, useServer);
}
902167
private static NetworkConfig fromFile(File configFile, boolean isJson) throws InvalidArgumentException, IOException, NetworkConfigurationException {

        // Sanity check
        if (configFile == null) {
            throw new InvalidArgumentException("configFile must be specified");
        }

        if (logger.isTraceEnabled()) {
            logger.trace(format("NetworkConfig.fromFile: %s  isJson = %b", configFile.getAbsolutePath(), isJson));
        }

        NetworkConfig config;

        // Json file
        try (InputStream stream = new FileInputStream(configFile)) {
            config = isJson ? fromJsonStream(stream) : fromYamlStream(stream);
        }

        return config;
    }
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)
1008986
void prepare(Map stormConf, TopologyContext context, OutputCollector collector,
                 KeyValueState<TaskStream, WindowState> windowState) {
        init(stormConf, context, collector, windowState);
        super.prepare(stormConf, context, collector);
    }
516512
function writeFabricServiceGradleHook(config) {
    console.log("Install Fabric-build-gradle hook.");
    try {
        if (!fs.existsSync(path.join(appRoot, "hooks"))) {
            fs.mkdirSync(path.join(appRoot, "hooks"));
        }
        if (!fs.existsSync(path.join(appRoot, "hooks", "after-prepare"))) {
            fs.mkdirSync(path.join(appRoot, "hooks", "after-prepare"));
        }
        var scriptContent =
            `
var path = require("path");
var fs = require("fs");
module.exports = function($logger, $projectData, hookArgs) {
  var platform = hookArgs.platform.toLowerCase();

  function updateAppGradleScript(file) {
    var appBuildGradleContent = fs.readFileSync(file).toString();
    if (!appBuildGradleContent.match(/.*fabric.*/)) {
      $logger.trace("Configuring Fabric for Android");
      var search = -1;

      search = appBuildGradleContent.indexOf("repositories {", 0);
      if (search == -1) {
          return;
      }
      appBuildGradleContent = appBuildGradleContent.substr(0, search + 14) + '	    maven { url "https://maven.fabric.io/public" }\\n' + appBuildGradleContent.substr(search + 14);

      // TODO add to buildTypes entry
      // appBuildGradleContent = appBuildGradleContent + '\\ndebug { \\n   ext.enableCrashlytics = false\\n}\\n';

      search = appBuildGradleContent.indexOf("apply plugin: \\"com.android.application\\"");
      if (search == -1) {
          return;
      }
      appBuildGradleContent = appBuildGradleContent.substr(0, search + 39) + '\\napply plugin: "io.fabric"\\n' + appBuildGradleContent.substr(search + 39);

      fs.writeFileSync(file, appBuildGradleContent);
      $logger.trace('Written build.gradle');

    }
    if (appBuildGradleContent.indexOf("buildMetadata.finalizedBy(copyMetadata)") === -1) {
      appBuildGradleContent = appBuildGradleContent.replace("ensureMetadataOutDir.finalizedBy(buildMetadata)", "ensureMetadataOutDir.finalizedBy(buildMetadata)\\n\\t\\tbuildMetadata.finalizedBy(copyMetadata)");
      appBuildGradleContent += \`
task copyMetadata {
  doLast {
    copy {
        from "$projectDir/src/main/assets/metadata"
        def toDir = project.hasProperty("release") ? "release" : "debug";
        if (new File("$projectDir/build/intermediates/assets").listFiles() != null) {
          toDir = new File("$projectDir/build/intermediates/assets").listFiles()[0].name
          if (toDir != 'debug' && toDir != 'release') {
            toDir += "/release"
          }
        }
        into "$projectDir/build/intermediates/assets/" + toDir + "/metadata"
    }
  }
}
\`;
      fs.writeFileSync(file, appBuildGradleContent);
      $logger.trace('Written build.gradle');
    }
  }

  function updateGradleScript(file) {
    var buildGradleContent = fs.readFileSync(file).toString();
    if (!buildGradleContent.match(/.*fabric.*/)) {
      $logger.trace("Configuring Fabric for Android");
      var search = -1;

      search = buildGradleContent.indexOf("repositories", 0);
      if (search == -1) {
          return;
      }
      search = buildGradleContent.indexOf("}", search);
      buildGradleContent = buildGradleContent.substr(0, search - 1) + '	    maven { url "https://maven.fabric.io/public" }\\n' + buildGradleContent.substr(search - 1);

      search = buildGradleContent.indexOf("dependencies", search);
      if (search == -1) {
          return;
      }
      search = buildGradleContent.indexOf("}", search);
      if (search == -1) {
          return;
      }
      buildGradleContent = buildGradleContent.substr(0, search - 1) + '	    classpath "io.fabric.tools:gradle:${FABRIC_GRADLE_TOOLS}"\\n' + buildGradleContent.substr(search - 1);

      fs.writeFileSync(file, buildGradleContent);
      $logger.trace('Written build.gradle');
    }
  }

  if (platform === 'android') {

      var apiKey = "${config.api_key}";
      var apiSecret = "${config.api_secret}";
      var androidPlatformDir = path.join(__dirname, "..", "..", 'platforms', 'android');
      var androidAppPlatformDir = path.join(__dirname, "..", "..", 'platforms', 'android', 'app');
      var gradleScript = path.join(androidPlatformDir, 'build.gradle');
      var gradleAppScript = path.join(androidAppPlatformDir, 'build.gradle');

      if (fs.existsSync(gradleAppScript)) {
        updateAppGradleScript(gradleAppScript);
        updateGradleScript(gradleScript);
      } else {
        updateGradleScript(gradleScript);
      }

      var settingsJson = path.join(__dirname, "..", "..", "platforms", "android", "app", "src", "main", "res", "fabric.properties");

      var propertiesContent = '# Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public\\n';
      propertiesContent+='apiKey = ' + apiKey + '\\n';
      propertiesContent+='apiSecret = ' + apiSecret + '\\n';
      fs.writeFileSync(settingsJson, propertiesContent);
      $logger.trace('Written fabric.properties');

  }
};
`;
        console.log("Writing 'nativescript-fabric-gradle.js' to " + appRoot + "hooks/after-prepare");
        var scriptPath = path.join(appRoot, "hooks", "after-prepare", "nativescript-fabric-gradle.js");
        fs.writeFileSync(scriptPath, scriptContent);
    } catch (e) {
        console.log("Failed to install nativescript-fabric-gradle hook.");
        console.log(e);
        throw e;
    }
}
800889
def web_hook_receiver(sender, **kwargs):
    """"""

    deployment = Deployment.objects.get(pk=kwargs.get('deployment_id'))

    hooks = deployment.web_hooks

    if not hooks:
        return

    for hook in hooks:

        data = payload_generator(deployment)

        deliver_hook(deployment, hook.url, data)
1310930
def _hook(self, hook_name, doc_uri=None, **kwargs):
        """"""
        doc = self.workspace.get_document(doc_uri) if doc_uri else None
        hook_handlers = self.config.plugin_manager.subset_hook_caller(hook_name, self.config.disabled_plugins)
        return hook_handlers(config=self.config, workspace=self.workspace, document=doc, **kwargs)
471920
public function loadConfigsByHook($hook, $reload = false)
    {
        // Load configs from DB
        $data = $this->app->db->conn()->prepare(
            'SELECT * FROM ' . $this->app->db->getPrefix() . 'config
                         WHERE `config_loadhook` = ?');
        $data->execute(array($hook));
        $data = $data->fetchAll(\PDO::FETCH_ASSOC);
        foreach ($data as $config) {
            // Load corresponding class and get config array
            if ($reload || !$this->configExists($config['config_name'])) {
                $this->config[$config['config_name']] = $this->createConfigObject($config['config_name'], $config['config_data'], true);
            }
        }
    }
586642
def generate(env):
    """"""
    import SCons.Defaults
    import SCons.Tool

    set_vars(env)

    static_obj, shared_obj = SCons.Tool.createObjBuilders(env)

    for suffix in CSuffixes:
        static_obj.add_action(suffix, SCons.Defaults.CAction)
        shared_obj.add_action(suffix, SCons.Defaults.ShCAction)

    for suffix in CXXSuffixes:
        static_obj.add_action(suffix, SCons.Defaults.CXXAction)
        shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction)

    env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -nolink -o $TARGET $SOURCES'

    env['CC']         = 'mwcc'
    env['CCCOM']      = '$CC $CFLAGS $CCFLAGS $CCCOMFLAGS'

    env['CXX']        = 'mwcc'
    env['CXXCOM']     = '$CXX $CXXFLAGS $CCCOMFLAGS'

    env['SHCC']       = '$CC'
    env['SHCCFLAGS']  = '$CCFLAGS'
    env['SHCFLAGS']   = '$CFLAGS'
    env['SHCCCOM']    = '$SHCC $SHCFLAGS $SHCCFLAGS $CCCOMFLAGS'

    env['SHCXX']       = '$CXX'
    env['SHCXXFLAGS']  = '$CXXFLAGS'
    env['SHCXXCOM']    = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS'

    env['CFILESUFFIX'] = '.c'
    env['CXXFILESUFFIX'] = '.cpp'
    env['CPPDEFPREFIX']  = '-D'
    env['CPPDEFSUFFIX']  = ''
    env['INCPREFIX']  = '-I'
    env['INCSUFFIX']  = ''
1003421
def dispatch_hook(key, hooks, hook_data):
    """"""

    hooks = hooks or dict()

    if key in hooks:
        try:
            return hooks.get(key).__call__(hook_data) or hook_data

        except Exception, why:
            warnings.warn(str(why))

    return hook_data
531653
private static NetworkConfig load(JsonObject jsonConfig) throws InvalidArgumentException, NetworkConfigurationException {

        // Sanity check
        if (jsonConfig == null) {
            throw new InvalidArgumentException("config must be specified");
        }

        return new NetworkConfig(jsonConfig);
    }
1215885
def create_hook(self, repo_id, repo_name):
        """"""
        config = dict(
            url=self.webhook_url,
            content_type='json',
            secret=current_app.config['GITHUB_SHARED_SECRET'],
            insecure_ssl='1' if current_app.config['GITHUB_INSECURE_SSL']
                         else '0',
        )

        ghrepo = self.api.repository_with_id(repo_id)
        if ghrepo:
            try:
                hook = ghrepo.create_hook(
                    'web',  # GitHub identifier for webhook service
                    config,
                    events=['release'],
                )
            except github3.GitHubError as e:
                # Check if hook is already installed
                hook_errors = (m for m in e.errors
                               if m['code'] == 'custom' and
                               m['resource'] == 'Hook')
                if next(hook_errors, None):
                    hooks = (h for h in ghrepo.hooks()
                             if h.config.get('url', '') == config['url'])
                    hook = next(hooks, None)
                    if hook:
                        hook.edit(config=config, events=['release'])
            finally:
                if hook:
                    Repository.enable(user_id=self.user_id,
                                      github_id=repo_id,
                                      name=repo_name,
                                      hook=hook.id)
                    return True
        return False
1358387
def serialize_hook(instance):
    

    if getattr(instance, 'serialize_hook', None) and callable(instance.serialize_hook):
        return instance.serialize_hook(hook=instance)
    if getattr(settings, 'HOOK_SERIALIZER', None):
        serializer = get_module(settings.HOOK_SERIALIZER)
        return serializer(instance, hook=instance)
    # if no user defined serializers, fallback to the django builtin!
    return {
        'hook': instance.dict(),
        'data': serializers.serialize('python', [instance])[0]
    }
647119
def add_io_hook(self, hook):
        
        def proxy(*args):
            hook(*args)

        self._io_hooks.append(proxy)

        return self.HookRemover(lambda: self._io_hooks.remove(proxy))