Build a predicate for namespace inclusion.
541345
def namespace_inclusion_builder(namespace: Strings) -> NodePredicate:
    """"""
    if isinstance(namespace, str):
        def namespace_filter(_: BELGraph, node: BaseEntity) -> bool:
            """Pass only for a node that has the enclosed namespace."""
            return NAMESPACE in node and node[NAMESPACE] == namespace

    elif isinstance(namespace, Iterable):
        namespaces = set(namespace)

        def namespace_filter(_: BELGraph, node: BaseEntity) -> bool:
            """Pass only for a node that has a namespace in the enclosed set."""
            return NAMESPACE in node and node[NAMESPACE] in namespaces

    else:
        raise TypeError('Invalid type for argument: {}'.format(namespace))

    return namespace_filter
336163
def Compile(self, filter_implementation):
    """"""
    arguments = [self.attribute]
    for argument in self.args:
      arguments.append(argument.Compile(filter_implementation))
    expander = filter_implementation.FILTERS['ValueExpander']
    context_cls = filter_implementation.FILTERS['Context']
    return context_cls(arguments=arguments,
                       value_expander=expander)
295325
def namespace(self):
        """"""
        if not self._operation_calculated:
            self._operation_calculated = True
            self._extract_operation_and_namespace()

        return self._namespace
1352041
def node_inclusion_predicate_builder(nodes: Iterable[BaseEntity]) -> NodePredicate:
    """"""
    nodes = set(nodes)

    @node_predicate
    def node_inclusion_predicate(node: BaseEntity) -> bool:
        """Return true if the node is in the given set of nodes."""
        return node in nodes

    return node_inclusion_predicate
571425
def p_namespace(self, p):
        ''''''
        p[0] = ast.Namespace(scope=p[2], name=p[3], lineno=p.lineno(1))
639369
function buildNamespaceReexport(meta, namespace, checkExport) {
    checkExport();
    return babelTemplate.statement(`
        (function() {
          for (var key in NAMESPACE) {
            if (NAMESPACE == null || !NAMESPACE.hasOwnProperty(key) || key === 'default' || key === '__esModule') return;
            VERIFY_NAME_LIST;
            exports[key] = NAMESPACE[key];
          }
        })();
    `)({
        NAMESPACE: namespace,
        VERIFY_NAME_LIST: meta.exportNameListName
            ? babelTemplate.statement(`
                if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return;
            `)({EXPORTS_LIST: meta.exportNameListName})
            : null
    });
}
688821
def predicate(self, name, func=None):
        
        if func is None:
            return functools.partial(self.predicate, name)
        self.predicates[name] = func
        return func
192005
def has_enumerated_namespace_name(self, namespace: str, name: str) -> bool:
        """"""
        return self.has_enumerated_namespace(namespace) and name in self.namespace_to_terms[namespace]
75791
def getprefixes(self):
        """"""
        namespaces = []
        for l in (self.params, self.types):
            for t,r in l:
                ns = r.namespace()
                if ns[1] is None: continue
                if ns[1] in namespaces: continue
                if Namespace.xs(ns) or Namespace.xsd(ns):
                    continue
                namespaces.append(ns[1])
                if t == r: continue
                ns = t.namespace()
                if ns[1] is None: continue
                if ns[1] in namespaces: continue
                namespaces.append(ns[1])
        i = 0
        namespaces.sort()
        for u in namespaces:
            p = self.nextprefix()
            ns = (p, u)
            self.prefixes.append(ns)
803309
def make_ns(self, ns):
        '''
        
        '''
        if self.namespace:
            val = {}
            val.update(self.namespace)
            val.update(ns)
            return val
        else:
            return ns
346142
def namespace(self, prefix=None):
        
        ns = self.schema.tns
        if ns[0] is None:
            ns = (prefix, ns[1])
        return ns
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;
    }
1123516
def has_regex_namespace_name(self, namespace: str, name: str) -> bool:
        """"""
        return self.has_regex_namespace(namespace) and self.namespace_to_pattern[namespace].match(name)
183630
def _namespace_dict(self) -> Mapping[str, Mapping[str, str]]:
        """"""
        return self.identifier_parser.namespace_to_terms
747966
def get_namespace_by_keyword_version(self, keyword: str, version: str) -> Optional[Namespace]:
        """"""
        filt = and_(Namespace.keyword == keyword, Namespace.version == version)
        return self.session.query(Namespace).filter(filt).one_or_none()
46870
def namespace(self, name=None, function=None, recursive=None):
        

        return (
            self._find_single(
                scopedef.scopedef_t._impl_matchers[namespace_t.namespace],
                name=name,
                function=function,
                recursive=recursive)
        )
912012
def get_namespaces_from_names(name, all_names):
    """"""
    names = configuration_namespaces.keys() if all_names else [name]
    for name in names:
        yield get_namespace(name)