Register a PHPTAL_Namespace and its attribute into PHPTAL.
424110
public function registerNamespace(PHPTAL_Namespace $ns)
    {
        $this->namespaces_by_uri[$ns->getNamespaceURI()] = $ns;
        $this->prefix_to_uri[$ns->getPrefix()] = $ns->getNamespaceURI();
        $prefix = strtolower($ns->getPrefix());
        foreach ($ns->getAttributes() as $name => $attribute) {
            $key = $prefix.':'.strtolower($name);
            $this->_dictionary[$key] = $attribute;
        }
    }
99623
def add(self, namespace_uri):
        """"""
        # See if this namespace is already mapped to an alias
        alias = self.namespace_to_alias.get(namespace_uri)
        if alias is not None:
            return alias

        # Fall back to generating a numerical alias
        i = 0
        while True:
            alias = 'ext' + str(i)
            try:
                self.addAlias(namespace_uri, alias)
            except KeyError:
                i += 1
            else:
                return alias

        assert False, "Not reached"
933952
def register(cls, name):
        

        def decorate(klazz):
            """ Decorator. """
            if name in cls._events:
                raise GerritError("Duplicate event: %s" % name)
            cls._events[name] = [klazz.__module__, klazz.__name__]
            klazz.name = name
            return klazz
        return decorate
1212051
static void register() {

        HashMap<String, Set<String>> seen = new HashMap<String, Set<String>>(); // old code used set, but was dependent on order

        for (Enumeration<String> s = Transliterator.getAvailableSources(); s.hasMoreElements(); ) {
            String source = s.nextElement();

            // Ignore the "Any" source
            if (source.equalsIgnoreCase(ANY)) continue;

            for (Enumeration<String> t = Transliterator.getAvailableTargets(source);
                 t.hasMoreElements(); ) {
                String target = t.nextElement();

                // Get the script code for the target.  If not a script, ignore.
                int targetScript = scriptNameToCode(target);
                if (targetScript == UScript.INVALID_CODE) {
                    continue;
                }

                Set<String> seenVariants = seen.get(target);
                if (seenVariants == null) {
                    seen.put(target, seenVariants = new HashSet<String>());
                }

                for (Enumeration<String> v = Transliterator.getAvailableVariants(source, target);
                     v.hasMoreElements(); ) {
                    String variant = v.nextElement();

                    // Only process each target/variant pair once
                    if (seenVariants.contains(variant)) {
                        continue;
                    }
                    seenVariants.add(variant);

                    String id;
                    id = TransliteratorIDParser.STVtoID(ANY, target, variant);
                    AnyTransliterator trans = new AnyTransliterator(id, target, variant,
                                                                    targetScript);
                    Transliterator.registerInstance(trans);
                    Transliterator.registerSpecialInverse(target, NULL_ID, false);
                }
            }
        }
    }
974603
private static function _processStartupMetadataGlobal()
    {
        // process global metadata
        if (isset($_SESSION['__ZF'])) {

            // expire globally expired values
            foreach ($_SESSION['__ZF'] as $namespace => $namespace_metadata) {

                // Expire Namespace by Time (ENT)
                if (isset($namespace_metadata['ENT']) && ($namespace_metadata['ENT'] > 0) && (time() > $namespace_metadata['ENT']) ) {
                    unset($_SESSION[$namespace]);
                    unset($_SESSION['__ZF'][$namespace]);
                }

                // Expire Namespace by Global Hop (ENGH) if it wasnt expired above
                if (isset($_SESSION['__ZF'][$namespace]) && isset($namespace_metadata['ENGH']) && $namespace_metadata['ENGH'] >= 1) {

                    $_SESSION['__ZF'][$namespace]['ENGH']--;

                    if ($_SESSION['__ZF'][$namespace]['ENGH'] === 0) {
                        if (isset($_SESSION[$namespace])) {
                            parent::$_expiringData[$namespace] = $_SESSION[$namespace];
                            unset($_SESSION[$namespace]);
                        }
                        unset($_SESSION['__ZF'][$namespace]);
                    }
                }

                // Expire Namespace Variables by Time (ENVT)
                if (isset($namespace_metadata['ENVT'])) {
                    foreach ($namespace_metadata['ENVT'] as $variable => $time) {
                        if (time() > $time) {
                            unset($_SESSION[$namespace][$variable]);
                            unset($_SESSION['__ZF'][$namespace]['ENVT'][$variable]);
                        }
                    }
                    if (empty($_SESSION['__ZF'][$namespace]['ENVT'])) {
                        unset($_SESSION['__ZF'][$namespace]['ENVT']);
                    }
                }

                // Expire Namespace Variables by Global Hop (ENVGH)
                if (isset($namespace_metadata['ENVGH'])) {
                    foreach ($namespace_metadata['ENVGH'] as $variable => $hops) {
                        $_SESSION['__ZF'][$namespace]['ENVGH'][$variable]--;

                        if ($_SESSION['__ZF'][$namespace]['ENVGH'][$variable] === 0) {
                            if (isset($_SESSION[$namespace][$variable])) {
                                parent::$_expiringData[$namespace][$variable] = $_SESSION[$namespace][$variable];
                                unset($_SESSION[$namespace][$variable]);
                            }
                            unset($_SESSION['__ZF'][$namespace]['ENVGH'][$variable]);
                        }
                    }
                    if (empty($_SESSION['__ZF'][$namespace]['ENVGH'])) {
                        unset($_SESSION['__ZF'][$namespace]['ENVGH']);
                    }
                }

                if (isset($namespace) && empty($_SESSION['__ZF'][$namespace])) {
                    unset($_SESSION['__ZF'][$namespace]);
                }
            }
        }

        if (isset($_SESSION['__ZF']) && empty($_SESSION['__ZF'])) {
            unset($_SESSION['__ZF']);
        }
    }
361305
def register(linter):
    '''
    
    '''
    linter.register_checker(ResourceLeakageChecker(linter))
    linter.register_checker(BlacklistedImportsChecker(linter))
    linter.register_checker(MovedTestCaseClassChecker(linter))
    linter.register_checker(BlacklistedLoaderModulesUsageChecker(linter))
    linter.register_checker(BlacklistedFunctionsChecker(linter))
1146847
def _create_namespace(namespace, apiserver_url):
    '''  '''
    # Prepare URL
    url = "{0}/api/v1/namespaces".format(apiserver_url)
    # Prepare data
    data = {
        "kind": "Namespace",
        "apiVersion": "v1",
        "metadata": {
            "name": namespace,
        }
    }
    log.trace("namespace creation requests: %s", data)
    # Make request
    ret = _kpost(url, data)
    log.trace("result is: %s", ret)
    # Check requests status
    return ret
1237351
public static function registerAutoload($base_namespace, $base_path, $extension = '.php')
    {
        spl_autoload_register(function ($class_name) use ($base_namespace, $base_path, $extension) {
            $file_path = self::getFilePathForClassName(
                $class_name,
                $base_namespace,
                $base_path,
                $extension
            );
            if ($file_path) {
                /** @noinspection PhpIncludeInspection */
                require_once $file_path;
            }
        });
    }
22784
public function register_namespaces_for_xpath() {
        $scnam = $this->activemanifest->get_cc_namespaces();
        foreach ($scnam as $key => $value) {
            $this->registerNS($key, $value);
        }
    }
593183
def namespace(self, namespace):
        """"""
        # pylint: disable=attribute-defined-outside-init
        self._namespace = _ensure_unicode(namespace)
        if self._namespace is not None:
            # In Python 3, a byte string cannot be stripped by a unicode char
            # Therefore, the stripping needs to be done after the unicode
            # conversion.
            self._namespace = self._namespace.strip('/')
675781
def register_std(self):
        ''' 
        '''
        self._namespace.register(STD_NAMESPACE, '')
        for cond in _ALL_CHECKERS:
            self.register(cond, STD_NAMESPACE, _ALL_CHECKERS[cond])
635093
private static function registerSymfonyYaml()
    {
        if (
            ! isset(self::$classMap['yaml'])
            and ! isset(self::$classMap['yml'])
            and class_exists(self::SYMFONY_YAML)
        ) {
            self::registerExtension('yaml', self::YAML_ADAPTER);
            self::registerExtension('yml', self::YAML_ADAPTER);
        }
    }
778064
def _set_namespace(self, namespaces):
        """"""
        self.namespace = {}
        for m in namespaces[::-1]:
            buf = _get_namespace(m)
            self.namespace.update(buf)
        self.namespace.update(self.__dict__)
1148244
def register(cls, latin_name, synonyms, reference_assemblies):
        
        species = Species(
            latin_name=latin_name,
            synonyms=synonyms,
            reference_assemblies=reference_assemblies)
        cls._latin_names_to_species[species.latin_name] = species
        for synonym in synonyms:
            if synonym in cls._common_names_to_species:
                raise ValueError("Can't use synonym '%s' for both %s and %s" % (
                    synonym,
                    species,
                    cls._common_names_to_species[synonym]))
            cls._common_names_to_species[synonym] = species
        for reference_name in reference_assemblies:
            if reference_name in cls._reference_names_to_species:
                raise ValueError("Can't use reference '%s' for both %s and %s" % (
                    reference_name,
                    species,
                    cls._reference_names_to_species[reference_name]))
            cls._reference_names_to_species[reference_name] = species
        return species
695029
public function register($namespace=null, $path = null, $psr4=false)
    {
        $this->load_ns[$namespace] = array($path, $psr4);
        if ($this->registered) { 
            return;
        }
        spl_autoload_register(array($this,"spl_autoload_callback"));
        $this->registered = true;
    }
5127
def register(cls):
    
    registry_entry = RegistryEntry(category = cls.category, namespace = cls.namespace, name = cls.name, cls=cls)
    if registry_entry not in registry and not exists_in_registry(cls.category, cls.namespace, cls.name):
        registry.append(registry_entry)
    else:
        log.warn("Class {0} already in registry".format(cls))
855049
def __add_namespaceinfo(self, ni):
        """"""
        self.__ns_uri_map[ni.uri] = ni
        for prefix in ni.prefixes:
            self.__prefix_map[prefix] = ni