Create Namespace function - creates a namespace map.

@param parent {Object} Current register.
@param parts {Array} Namespace location map.
@return parent {Object} current namespace.
436815
function createNamespace(parent, parts) {

  var part = getName(parts.shift());

  if (!parent[part]) {
    parent[part] = {};
  }

  if (parts.length) {
    parent = createNamespace(parent[part], parts);
  }

  return parent;
}
762880
function Messenger(namespace, options) {
  if (!(this instanceof Messenger)) {
    return new Messenger(namespace, options);
  }

  if (!namespace) {
    throw new Error('Cannot create Messenger without a namespace');
  }

  events.EventEmitter.call(this);

  this.namespace = namespace;
  this.options = merge(Object.create(Messenger.DEFAULTS), options || {});
  this.socketPath = this._getFileDescriptorPath(this.options.uid);

  this._init();
}
339097
private static function create_namespace( $parent, $name, $callable ) {
		$reflection  = new ReflectionClass( $callable );
		$doc_comment = self::get_doc_comment( $reflection );
		if ( ! $doc_comment ) {
			\WP_CLI::debug( null === $doc_comment ? "Failed to get doc comment for {$name}." : "No doc comment for {$name}.", 'commandfactory' );
		}
		$docparser = new \WP_CLI\DocParser( $doc_comment );

		return new CommandNamespace( $parent, $name, $docparser );
	}
571425
def p_namespace(self, p):
        ''''''
        p[0] = ast.Namespace(scope=p[2], name=p[3], lineno=p.lineno(1))
1159814
function main(args) {
  var inputPaths = [];
  var outputPath;

  for (var i = 0; i < args.length; ++i) {
    if (args[i] == '--output') {
      outputPath = args[i + 1];
      ++i;
    } else {
      inputPaths.push(args[i]);
    }
  }
  console.assert(outputPath,
                 'You must specify output file with --output <EXTERNS>');
  console.assert(inputPaths.length,
                 'You must specify at least one input file.');

  // Generate externs for all input paths.
  var names = new Set();
  var results = inputPaths.map(generateExterns.bind(null, names));

  // Sort them in dependency order.
  var sorted = topologicalSort(results, /* getDeps */ function(object) {
    return object.requires.map(function(id) {
      var dep = results.find(function(x) { return x.provides.includes(id); });
      console.assert(dep, 'Cannot find dependency: ' + id);
      return dep;
    });
  });

  // Generate namespaces for all externs.  For example, if we extern foo.bar.baz,
  // foo and foo.bar will both need to be declared first.
  var namespaces = new Set();
  var namespaceDeclarations = [];
  names.forEach(function(name) {
    // Add the full name "foo.bar.baz" and its prototype ahead of time.  We should
    // never generate these as namespaces.
    namespaces.add(name);
    namespaces.add(name + '.prototype');

    // For name "foo.bar.baz", iterate over partialName "foo" and "foo.bar".
    var pieces = name.split('.');
    for (var i = 1; i < pieces.length; ++i) {
      var partialName = pieces.slice(0, i).join('.');
      if (!namespaces.has(partialName)) {
        var declaration;
        if (i == 1) {
          declaration = '/** @namespace */\n';
          declaration += 'window.';
        } else {
          declaration = '/** @const */\n';
        }
        declaration += partialName + ' = {};\n';
        namespaceDeclarations.push(declaration);
        namespaces.add(partialName);
      }
    }
  });

  // Get externs.
  var externs = sorted.map(function(x) { return x.externs; }).join('');

  // Output generated externs, with an appropriate header.
  fs.writeFileSync(outputPath,
      '/**\n' +
      ' * @fileoverview Generated externs.  DO NOT EDIT!\n' +
      ' * @externs\n' +
      ' * @suppress {duplicate} To prevent compiler errors with the namespace\n' +
      ' *   being declared both here and by goog.provide in the library.\n' +
      ' */\n\n' +
      namespaceDeclarations.join('') + '\n' + externs);
}
824651
function namespace (options) {
  options.hash.kind = 'namespace'
  var result = ddata._identifier(options)
  return result ? options.fn(result) : 'ERROR, Cannot find namespace.'
}
716039
function Namespacer(settings, callback) {
      if (settings.namespace != null) {
        this.groupNamespace = settings.namespace;
      } else {
        callback('Error: \'namespace\' is not configured');
      }
      if (settings.templates != null) {
        this.templates = settings.templates;
      } else {
        callback('Error: \'templates\' is not configured');
      }
      if (settings.skiproot != null) {
        this.skiproot = settings.skiproot;
      }
      if ((this.groupNamespace != null) && (this.templates != null)) {
        this.callback = callback;
        this.namespaces = [];
        this.result = [];
        this.init();
      }
    }
1065738
function (_adapter) {
    if (!(this instanceof CNamespace)) {
        return new CNamespace(_adapter);
    }
    
    var re = new RegExp('^' + _adapter.namespace + '.|^'); //  new/^adapter.0.|^/, '')
    var isre = new RegExp('^' + _adapter.namespace);
    this.no = function no (s) {
        return s.replace(re, '');
    };
    this.remove = this.no;
    this.is = isre.test.bind(isre); //.bind(this);
    this.add = function add (s) {
        return s.replace(re, _adapter.namespace + '.')
    }
    this.add2 = function add (s) {
        return s.replace(re, _adapter.namespace + (s ? '.' : ''));
    }
}
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
256912
function createModel (namespace) {
  const model = (namespace) ? { namespace: namespace } : {}
  model.models = {}
  model.reducers = {}
  model.effects = {}
  model.subscriptions = {}
  model.state = {}

  return {
    start: function () {
      return model
    },
    state: function (value) {
      mutate(model.state, value)
    },
    reducer: function (key, value) {
      model.reducers[key] = value
    },
    subscription: function (key, value) {
      model.subscriptions[key] = value
    },
    effect: function (key, value) {
      model.effects[key] = value
    }
  }
}
210197
def apply_namespace(qname, apply_prefix, apply_uri)
      local_part, prefix, uri = qname
      
      if !prefix
        prefix = apply_prefix
        uri = apply_uri
      end

      [local_part, prefix, uri].compact
    end
992680
function using(ns) {
	let nsParts = ns.split('.');
	let parentObj = global;

	// Build an object tree as necessary for the namespace hierarchy.
	for (let i = 0; i < nsParts.length - 1; i++) {
		let nsObj = parentObj[nsParts[i]];
		if (!nsObj) {
			nsObj = {};
			parentObj[nsParts[i]] = nsObj;
		}
		parentObj = nsObj;
	}

	let lastNsPart = nsParts[nsParts.length - 1];
	let nsPackage = require(uwpRoot + ns.toLowerCase());

	// Merge in any already-loaded sub-namespaces.
	// This allows loading in non-hierarchical order.
	let nsObj = parentObj[lastNsPart];
	if (nsObj) {
		Object.keys(nsObj).forEach(key => {
			nsPackage[key] = nsObj[key];
		})
	}
	parentObj[lastNsPart] = nsPackage;
}
848799
private void initNamespaces()
    {
        // The initial prefix mappings will never be deleted because they are at element depth -1
        // (a kludge)

        // Define the default namespace (initially maps to "" uri)
        Stack stack;
        MappingRecord nn;
        nn = new MappingRecord(EMPTYSTRING, EMPTYSTRING, -1);
        stack = createPrefixStack(EMPTYSTRING);
        stack.push(nn);

        // define "xml" namespace
        nn = new MappingRecord(XML_PREFIX, "http://www.w3.org/XML/1998/namespace", -1);
        stack = createPrefixStack(XML_PREFIX);
        stack.push(nn);
    }
437013
def write_namespaces(self, namespaces):
        """"""
        self.printer.writelines(
            "def _mako_get_namespace(context, name):",
                "try:",
                    "return context.namespaces[(__name__, name)]",
                "except KeyError:",
                    "_mako_generate_namespaces(context)",
                "return context.namespaces[(__name__, name)]",
            None, None
        )
        self.printer.writeline("def _mako_generate_namespaces(context):")


        for node in namespaces.values():
            if 'import' in node.attributes:
                self.compiler.has_ns_imports = True
            self.printer.start_source(node.lineno)
            if len(node.nodes):
                self.printer.writeline("def make_namespace():")
                export = []
                identifiers = self.compiler.identifiers.branch(node)
                self.in_def = True
                class NSDefVisitor(object):
                    def visitDefTag(s, node):
                        s.visitDefOrBase(node)

                    def visitBlockTag(s, node):
                        s.visitDefOrBase(node)

                    def visitDefOrBase(s, node):
                        if node.is_anonymous:
                            raise exceptions.CompileException(
                                "Can't put anonymous blocks inside "
                                "<%namespace>",
                                **node.exception_kwargs
                            )
                        self.write_inline_def(node, identifiers, nested=False)
                        export.append(node.funcname)
                vis = NSDefVisitor()
                for n in node.nodes:
                    n.accept_visitor(vis)
                self.printer.writeline("return [%s]" % (','.join(export)))
                self.printer.writeline(None)
                self.in_def = False
                callable_name = "make_namespace()"
            else:
                callable_name = "None"

            if 'file' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.TemplateNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " templateuri=%s, callables=%s, "
                                " calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    node.parsed_attributes.get('file', 'None'),
                                    callable_name,
                                )
                            )
            elif 'module' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.ModuleNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri,"
                                " module=%s)" %
                                (
                                    node.name,
                                    callable_name,
                                    node.parsed_attributes.get(
                                                'module', 'None')
                                )
                            )
            else:
                self.printer.writeline(
                                "ns = runtime.Namespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    callable_name,
                                )
                            )
            if eval(node.attributes.get('inheritable', "False")):
                self.printer.writeline("context['self'].%s = ns" % (node.name))

            self.printer.writeline(
                "context.namespaces[(__name__, %s)] = ns" % repr(node.name))
            self.printer.write_blanks(1)
        if not len(namespaces):
            self.printer.writeline("pass")
        self.printer.writeline(None)
387676
function Namespace(server, name){
  this.name = name;
  this.server = server;
  this.sockets = {};
  this.connected = {};
  this.fns = [];
  this.ids = 0;
  this.rooms = [];
  this.flags = {};
  this.initAdapter();
}
1211312
private NamespaceContext buildNamespaceContext(Node node) {
        SimpleNamespaceContext simpleNamespaceContext = new SimpleNamespaceContext();
        Map<String, String> namespaces = XMLUtils.lookupNamespaces(node.getOwnerDocument());

        // add default namespace mappings
        namespaces.putAll(namespaceContextBuilder.getNamespaceMappings());

        simpleNamespaceContext.setBindings(namespaces);

        return simpleNamespaceContext;
    }
8879
function(target, namespace, graph) {
      
      //if the first param is a string, 
      //we are including the namespace on Sysmo
      if (typeof target == 'string') {
        graph = namespace;
        namespace = target;
        target = Sysmo;
      }
      
      //create namespace on target
      Sysmo.namespace(namespace, target);
      //get inner most object in namespace
      target = Sysmo.getDeepValue(target, namespace);
      //merge graph on inner most object in namespace
      return Sysmo.extend(target, graph);
      
    }