A namespace is usually an absolute file name of the grammar.
        A special namespace '__base__' is used for BASETYPE namespace.
519194
def _enter_namespace(self, namespace_name):
        
        if namespace_name not in self.namespaces:
            self.namespaces[namespace_name] = {}

            # BASETYPE namespace is imported in each namespace
            # as the first namespace to be searched.
            self._imported_namespaces[namespace_name] = \
                [self.namespaces['__base__']]

        self._namespace_stack.append(namespace_name)
557309
def object_ns(self):
        
        return Namespace(
            subject=self.object_,
            object_=None,
            prefix=self.prefix,
            qualifier=self.qualifier,
            version=self.version,
        )
972908
@Override
    public void handleNamespace(String prefix, String namespace) {
	if (prefix.equals("")) {
	    prefix = "def";
	}
	this.document.getNamespace().register(prefix, namespace);
	//pFactory.setNamespaces(this.document.getNss());
	//this.revnss.put(namespace, prefix);
    }
118785
function namespace() {
  var args = Array.prototype.slice.call(arguments);
  var setComponents = function(context, first, rest) {
    if(!context[first]) {
      context[first] = {
        models: {},
        collections: {},
        views: {},
      };
    }
    if(rest.length) {
      setComponents(context[first], _.first(rest), _.rest(rest));
    }
  };
  setComponents(window, _.first(args), _.rest(args));
}
543879
function namespaceBoundary(namespace, line) {
      // Demarcate a namespace "boundary" to build up an array of namespace line
      // "ranges" to be able to find which namespace a piece of code belongs to.
      if (currentNamespaceRange) {
        namespaceRanges.push(currentNamespaceRange);
      }
      if (namespace) {
        currentNamespaceRange = {
          name: namespace,
          line: line
        };
      }
    }
515171
function buildGrammar(match, namespace, optOhmGrammarForTesting) {
  var builder = new Builder();
  var decl;
  var currentRuleName;
  var currentRuleFormals;
  var overriding = false;
  var metaGrammar = optOhmGrammarForTesting || ohmGrammar;

  // A visitor that produces a Grammar instance from the CST.
  var helpers = metaGrammar.createSemantics().addOperation('visit', {
    Grammar: function(n, s, open, rs, close) {
      var grammarName = n.visit();
      decl = builder.newGrammar(grammarName, namespace);
      s.visit();
      rs.visit();
      var g = decl.build();
      g.source = this.source.trimmed();
      if (grammarName in namespace) {
        throw errors.duplicateGrammarDeclaration(g, namespace);
      }
      namespace[grammarName] = g;
      return g;
    },

    SuperGrammar: function(_, n) {
      var superGrammarName = n.visit();
      if (superGrammarName === 'null') {
        decl.withSuperGrammar(null);
      } else {
        if (!namespace || !(superGrammarName in namespace)) {
          throw errors.undeclaredGrammar(superGrammarName, namespace, n.source);
        }
        decl.withSuperGrammar(namespace[superGrammarName]);
      }
    },

    Rule_define: function(n, fs, d, _, b) {
      currentRuleName = n.visit();
      currentRuleFormals = fs.visit()[0] || [];
      // If there is no default start rule yet, set it now. This must be done before visiting
      // the body, because it might contain an inline rule definition.
      if (!decl.defaultStartRule && decl.ensureSuperGrammar() !== Grammar.ProtoBuiltInRules) {
        decl.withDefaultStartRule(currentRuleName);
      }
      var body = b.visit();
      var description = d.visit()[0];
      var source = this.source.trimmed();
      return decl.define(currentRuleName, currentRuleFormals, body, description, source);
    },
    Rule_override: function(n, fs, _, b) {
      currentRuleName = n.visit();
      currentRuleFormals = fs.visit()[0] || [];
      overriding = true;
      var body = b.visit();
      var source = this.source.trimmed();
      var ans = decl.override(currentRuleName, currentRuleFormals, body, null, source);
      overriding = false;
      return ans;
    },
    Rule_extend: function(n, fs, _, b) {
      currentRuleName = n.visit();
      currentRuleFormals = fs.visit()[0] || [];
      var body = b.visit();
      var source = this.source.trimmed();
      var ans = decl.extend(currentRuleName, currentRuleFormals, body, null, source);
      return ans;
    },
    RuleBody: function(_, terms) {
      var args = terms.visit();
      return builder.alt.apply(builder, args).withSource(this.source);
    },

    Formals: function(opointy, fs, cpointy) {
      return fs.visit();
    },

    Params: function(opointy, ps, cpointy) {
      return ps.visit();
    },

    Alt: function(seqs) {
      var args = seqs.visit();
      return builder.alt.apply(builder, args).withSource(this.source);
    },

    TopLevelTerm_inline: function(b, n) {
      var inlineRuleName = currentRuleName + '_' + n.visit();
      var body = b.visit();
      var source = this.source.trimmed();
      var isNewRuleDeclaration =
          !(decl.superGrammar && decl.superGrammar.rules[inlineRuleName]);
      if (overriding && !isNewRuleDeclaration) {
        decl.override(inlineRuleName, currentRuleFormals, body, null, source);
      } else {
        decl.define(inlineRuleName, currentRuleFormals, body, null, source);
      }
      var params = currentRuleFormals.map(function(formal) { return builder.app(formal); });
      return builder.app(inlineRuleName, params).withSource(body.source);
    },

    Seq: function(expr) {
      return builder.seq.apply(builder, expr.visit()).withSource(this.source);
    },

    Iter_star: function(x, _) {
      return builder.star(x.visit()).withSource(this.source);
    },
    Iter_plus: function(x, _) {
      return builder.plus(x.visit()).withSource(this.source);
    },
    Iter_opt: function(x, _) {
      return builder.opt(x.visit()).withSource(this.source);
    },

    Pred_not: function(_, x) {
      return builder.not(x.visit()).withSource(this.source);
    },
    Pred_lookahead: function(_, x) {
      return builder.lookahead(x.visit()).withSource(this.source);
    },

    Lex_lex: function(_, x) {
      return builder.lex(x.visit()).withSource(this.source);
    },

    Base_application: function(rule, ps) {
      return builder.app(rule.visit(), ps.visit()[0] || []).withSource(this.source);
    },
    Base_range: function(from, _, to) {
      return builder.range(from.visit(), to.visit()).withSource(this.source);
    },
    Base_terminal: function(expr) {
      return builder.terminal(expr.visit()).withSource(this.source);
    },
    Base_paren: function(open, x, close) {
      return x.visit();
    },

    ruleDescr: function(open, t, close) {
      return t.visit();
    },
    ruleDescrText: function(_) {
      return this.sourceString.trim();
    },

    caseName: function(_, space1, n, space2, end) {
      return n.visit();
    },

    name: function(first, rest) {
      return this.sourceString;
    },
    nameFirst: function(expr) {},
    nameRest: function(expr) {},

    terminal: function(open, cs, close) {
      return cs.visit().join('');
    },

    oneCharTerminal: function(open, c, close) {
      return c.visit();
    },

    terminalChar: function(_) {
      return common.unescapeChar(this.sourceString);
    },

    escapeChar: function(_) {
      return this.sourceString;
    },

    NonemptyListOf: function(x, _, xs) {
      return [x.visit()].concat(xs.visit());
    },
    EmptyListOf: function() {
      return [];
    },

    _terminal: function() {
      return this.primitiveValue;
    }
  });
  return helpers(match).visit();
}
408266
def ensure_namespace(self, name):
        # type: (str) -> ApiNamespace
        
        if name not in self.namespaces:
            self.namespaces[name] = ApiNamespace(name)
        return self.namespaces[name]
19375
public final BELScriptWalker.define_namespace_return define_namespace() throws RecognitionException {
        BELScriptWalker.define_namespace_return retval = new BELScriptWalker.define_namespace_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        CommonTree _first_0 = null;
        CommonTree _last = null;

        CommonTree isdefault=null;
        CommonTree name=null;
        CommonTree rloc=null;
        CommonTree string_literal23=null;
        CommonTree string_literal24=null;
        CommonTree string_literal25=null;
        CommonTree string_literal26=null;

        CommonTree isdefault_tree=null;
        CommonTree name_tree=null;
        CommonTree rloc_tree=null;
        CommonTree string_literal23_tree=null;
        CommonTree string_literal24_tree=null;
        CommonTree string_literal25_tree=null;
        CommonTree string_literal26_tree=null;

        try {
            // BELScriptWalker.g:308:17: ( ( 'DEFINE' ( (isdefault= 'DEFAULT' )? 'NAMESPACE' ) ) name= OBJECT_IDENT 'AS' 'URL' rloc= QUOTED_VALUE )
            // BELScriptWalker.g:309:5: ( 'DEFINE' ( (isdefault= 'DEFAULT' )? 'NAMESPACE' ) ) name= OBJECT_IDENT 'AS' 'URL' rloc= QUOTED_VALUE
            {
            root_0 = (CommonTree)adaptor.nil();

            // BELScriptWalker.g:309:5: ( 'DEFINE' ( (isdefault= 'DEFAULT' )? 'NAMESPACE' ) )
            // BELScriptWalker.g:309:6: 'DEFINE' ( (isdefault= 'DEFAULT' )? 'NAMESPACE' )
            {
            _last = (CommonTree)input.LT(1);
            string_literal23=(CommonTree)match(input,27,FOLLOW_27_in_define_namespace312); 
            string_literal23_tree = (CommonTree)adaptor.dupNode(string_literal23);

            adaptor.addChild(root_0, string_literal23_tree);

            // BELScriptWalker.g:309:15: ( (isdefault= 'DEFAULT' )? 'NAMESPACE' )
            // BELScriptWalker.g:309:16: (isdefault= 'DEFAULT' )? 'NAMESPACE'
            {
            // BELScriptWalker.g:309:16: (isdefault= 'DEFAULT' )?
            int alt7=2;
            int LA7_0 = input.LA(1);

            if ( (LA7_0==28) ) {
                alt7=1;
            }
            switch (alt7) {
                case 1 :
                    // BELScriptWalker.g:309:17: isdefault= 'DEFAULT'
                    {
                    _last = (CommonTree)input.LT(1);
                    isdefault=(CommonTree)match(input,28,FOLLOW_28_in_define_namespace318); 
                    isdefault_tree = (CommonTree)adaptor.dupNode(isdefault);

                    adaptor.addChild(root_0, isdefault_tree);


                    }
                    break;

            }

            _last = (CommonTree)input.LT(1);
            string_literal24=(CommonTree)match(input,29,FOLLOW_29_in_define_namespace322); 
            string_literal24_tree = (CommonTree)adaptor.dupNode(string_literal24);

            adaptor.addChild(root_0, string_literal24_tree);


            }


            }

            _last = (CommonTree)input.LT(1);
            name=(CommonTree)match(input,OBJECT_IDENT,FOLLOW_OBJECT_IDENT_in_define_namespace328); 
            name_tree = (CommonTree)adaptor.dupNode(name);

            adaptor.addChild(root_0, name_tree);

            _last = (CommonTree)input.LT(1);
            string_literal25=(CommonTree)match(input,30,FOLLOW_30_in_define_namespace330); 
            string_literal25_tree = (CommonTree)adaptor.dupNode(string_literal25);

            adaptor.addChild(root_0, string_literal25_tree);

            _last = (CommonTree)input.LT(1);
            string_literal26=(CommonTree)match(input,31,FOLLOW_31_in_define_namespace332); 
            string_literal26_tree = (CommonTree)adaptor.dupNode(string_literal26);

            adaptor.addChild(root_0, string_literal26_tree);

            _last = (CommonTree)input.LT(1);
            rloc=(CommonTree)match(input,QUOTED_VALUE,FOLLOW_QUOTED_VALUE_in_define_namespace336); 
            rloc_tree = (CommonTree)adaptor.dupNode(rloc);

            adaptor.addChild(root_0, rloc_tree);


                    final String nametext = name.getText();
                    final String rloctext = rloc.getText();

                    BELNamespaceDefinition belnsd;
                    if (isdefault != null) {
                        belnsd = new BELNamespaceDefinition(nametext, rloctext, true);
                    } else {
                        belnsd = new BELNamespaceDefinition(nametext, rloctext, false);
                    }

                    nslist.add(belnsd);
                    definedNamespaces.put(nametext, belnsd);
                

            }

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }
65851
def _node_has_namespace_helper(node: BaseEntity, namespace: str) -> bool:
        
        return namespace == node.get(NAMESPACE)
1086358
def gridfs_namespace(self, plain_src_ns):
        
        namespace = self.lookup(plain_src_ns)
        if namespace and namespace.gridfs:
            return namespace.dest_name
        return 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();
}
571425
def p_namespace(self, p):
        ''''''
        p[0] = ast.Namespace(scope=p[2], name=p[3], lineno=p.lineno(1))
348913
private SemanticSpace getSSpace(String name) {
        String aliased = aliasToFileName.get(name);
        return (aliased != null) 
            ? fileNameToSSpace.get(aliased)
            : fileNameToSSpace.get(name);
    }
1315100
def declares_namespace_package(filename):
  """"""

  import ast

  with open(filename) as fp:
    init_py = ast.parse(fp.read(), filename)
  calls = [node for node in ast.walk(init_py) if isinstance(node, ast.Call)]
  for call in calls:
    if len(call.args) != 1:
      continue
    if isinstance(call.func, ast.Attribute) and call.func.attr != 'declare_namespace':
      continue
    if isinstance(call.func, ast.Name) and call.func.id != 'declare_namespace':
      continue
    if isinstance(call.args[0], ast.Name) and call.args[0].id == '__name__':
      return True
  return False
490505
function Namespace(path, hex) {
  this.hex = !!hex
  this.keyEncoding = hex ? 'utf8' : 'binary'

  this.path = path
  this.buffer = bytewise.encode(path)
  this.prehooks = []
  this.posthooks = []
}
1238597
function qualify(name, namespace) {
  if (~name.indexOf('.')) {
    name = name.replace(/^\./, ''); // Allow absolute referencing.
  } else if (namespace) {
    name = namespace + '.' + name;
  }
  name.split('.').forEach(function (part) {
    if (!isValidName(part)) {
      throw new Error(f('invalid name: %j', name));
    }
  });
  var tail = unqualify(name);
  // Primitives are always in the global namespace.
  return isPrimitive(tail) ? tail : name;
}
1076196
def _add_namespace(self, namespace):
        """"""
        src_name = namespace.source_name
        if "*" in src_name:
            self._regex_map.append((namespace_to_regex(src_name), namespace))
        else:
            self._add_plain_namespace(namespace)