namespace : KEYWORD ID NL
                     | KEYWORD ID NL INDENT docsection DEDENT
496743
def p_namespace(self, p):
        """"""
        if p[1] == 'namespace':
            doc = None
            if len(p) > 4:
                doc = p[5]
            p[0] = AstNamespace(
                self.path, p.lineno(1), p.lexpos(1), p[2], doc)
        else:
            raise ValueError('Expected namespace keyword')
1117297
def _add_namespaces(self):
        
        self.doc.add_namespace(NIDM)
        self.doc.add_namespace(NIIRI)
        self.doc.add_namespace(CRYPTO)
        self.doc.add_namespace(DCT)
        self.doc.add_namespace(DC)
        self.doc.add_namespace(NFO)
        self.doc.add_namespace(OBO)
        self.doc.add_namespace(SCR)
        self.doc.add_namespace(NIF)
1133563
def _get_embeddable_interpretation_doc(indent = 0):
    

    output_rows = []

    # Pull out the doc string and put it in a table.
    for name in sorted(dir(_interpretations)):
        if name.startswith("_") or "__" not in name:
            continue

        interpretation, type_str = name.split("__")

        func = getattr(_interpretations, name)

        output_rows.append("%s (%s type):" % (interpretation, type_str))
        output_rows += [("  " + line) for line in _textwrap.dedent(func.__doc__).strip().split("\n")]

        output_rows.append("")

    return "\n".join(" "*indent + line for line in output_rows)
183630
def _namespace_dict(self) -> Mapping[str, Mapping[str, str]]:
        """"""
        return self.identifier_parser.namespace_to_terms
505364
private static void fixupNamespace(Document doc) throws MarshalException {

		Node n;
		Element el;
		String prefix;

		n = doc.getFirstChild();

		if (n.getNodeType() != Node.ELEMENT_NODE) {
			throw new RuntimeException("No element");
		}

		el = (Element) n;

		prefix = el.getPrefix();

		if (prefix != null && prefix.length() > 0) {
			el.setPrefix(null);
		} else {
			prefix = "";
		}

		dropNamespaceDecls(el);

		removePrefixFromChildren(el, prefix);
	}
691748
def fixup_indent(suite):
    
    kids = suite.children[::-1]
    # find the first indent
    while kids:
        node = kids.pop()
        if node.type == token.INDENT:
            break

    # find the first Leaf
    while kids:
        node = kids.pop()
        if isinstance(node, Leaf) and node.type != token.DEDENT:
            if node.prefix:
                node.prefix = u''
            return
        else:
            kids.extend(node.children[::-1])
565425
def _pop_indent_stack(self, node, node_type=None, action=None):
        """"""
        indent = self._get_indent(node)
        indent_stack = copy.deepcopy(self._indent_stack)
        # Find enclosing scope
        while (len(indent_stack) > 1) and (
            (
                (indent <= indent_stack[-1]["level"])
                and (indent_stack[-1]["type"] != "module")
            )
            or (indent_stack[-1]["type"] == "prop")
        ):
            self._close_callable(node)
            indent_stack.pop()
        # Construct new callable name
        name = (
            (
                node.targets[0].id
                if hasattr(node.targets[0], "id")
                else node.targets[0].value.id
            )
            if node_type == "prop"
            else node.name
        )
        element_full_name = ".".join(
            [self._module]
            + [
                indent_dict["prefix"]
                for indent_dict in indent_stack
                if indent_dict["type"] != "module"
            ]
            + [name]
        ) + ("({0})".format(action) if action else "")
        # Add new callable entry to indentation stack
        self._indent_stack = indent_stack
        self._indent_stack.append(
            {
                "level": indent,
                "prefix": name,
                "type": node_type,
                "full_name": element_full_name,
                "lineno": node.lineno,
            }
        )
        return element_full_name
1297725
def get_namespace_at( self, namespace_id, block_number ):
        
        cur = self.db.cursor() 
        return namedb_get_namespace_at(cur, namespace_id, block_number, include_expired=True)
246735
def grep_full_py_identifiers(tokens):
    
    global py_keywords
    tokens = list(tokens)
    i = 0
    while i < len(tokens):
        token_type, token = tokens[i]
        i += 1
        if token_type != "id":
            continue
        while i+1 < len(tokens) and tokens[i] == ("op", ".") and tokens[i+1][0] == "id":
            token += "." + tokens[i+1][1]
            i += 2
        if token == "":
            continue
        if token in py_keywords:
            continue
        if token[0] in ".0123456789":
            continue
        yield token
480483
def join_match_funcdef(tokens):
    """"""
    if len(tokens) == 2:
        (func, insert_after_docstring), body = tokens
        docstring = None
    elif len(tokens) == 3:
        (func, insert_after_docstring), docstring, body = tokens
    else:
        raise CoconutInternalException("invalid docstring insertion tokens", tokens)
    # insert_after_docstring and body are their own self-contained suites, but we
    # expect them to both be one suite, so we have to join them together
    insert_after_docstring, dedent = split_trailing_indent(insert_after_docstring)
    indent, body = split_leading_indent(body)
    indentation = collapse_indents(dedent + indent)
    return (
        func
        + (docstring if docstring is not None else "")
        + insert_after_docstring
        + indentation
        + body
    )
370582
private void registerPrefixIntersection(String field, String prefix,
      int start, int end,
      HashMap<String, HashSet<Integer>> docFieldAdministration) {
    if (!intersectingPrefixes.containsKey(field)) {
      intersectingPrefixes.put(field, new HashSet<String>());
    } else if (intersectingPrefixes.get(field).contains(prefix)) {
      return;
    }
    HashSet<Integer> docFieldPrefixAdministration;
    if (!docFieldAdministration.containsKey(prefix)) {
      docFieldPrefixAdministration = new HashSet<>();
      docFieldAdministration.put(prefix, docFieldPrefixAdministration);
    } else {
      docFieldPrefixAdministration = docFieldAdministration.get(prefix);
      // check
      for (int p = start; p <= end; p++) {
        if (docFieldPrefixAdministration.contains(p)) {
          intersectingPrefixes.get(field).add(prefix);
          docFieldAdministration.remove(prefix);
          return;
        }
      }
    }
    // update
    for (int p = start; p <= end; p++) {
      docFieldPrefixAdministration.add(p);
    }
  }
352864
def do_markdownlaceholder(parser, token):
    
    name, params = parse_placeholder(parser, token)
    return MarkdownPlaceholderNode(name, **params)
251672
def qn(self, namespace):
        """"""
        nsmap = {
            'text': 'urn:oasis:names:tc:opendocument:xmlns:text:1.0',
        }
        spl = namespace.split(':')
        return '{{{}}}{}'.format(nsmap[spl[0]], spl[1])
1179613
def indent(self, n=1):
        '''
        
        '''
        return WorkLog(columns=self.columns,
                       bullet=(self.blanks + self.bullet),
                       stdout=self.stdout, stderr=self.stderr)
1079427
static public Namespace gatherNamespaces(Document doc) {
   	NamespaceGatherer gatherer=new NamespaceGatherer();	
   	u.forAllStatementOrBundle(doc.getStatementOrBundle(), 
   	                          gatherer);
   	
   	Namespace ns=gatherer.getNamespace();
   	return ns;
    }
956749
private String generatePrefix(String namespace) {
		// assert namespace == namespace.intern();
		while (true) {
			++autoDeclaredPrefixes;
			// fast lookup uses table that was pre-initialized in static{} ....
			final String prefix = autoDeclaredPrefixes < precomputedPrefixes.length ? precomputedPrefixes[autoDeclaredPrefixes] : ("n" + autoDeclaredPrefixes).intern();
			// make sure this prefix is not declared in any scope (avoid hiding
			// in-scope prefixes)!
			for (int i = namespaceEnd - 1; i >= 0; --i) {
				if (prefix == namespacePrefix[i]) {
					continue; // prefix is already declared - generate new and
								// try again
				}
			}
			// declare prefix

			if (namespaceEnd >= namespacePrefix.length) {
				ensureNamespacesCapacity();
			}
			namespacePrefix[namespaceEnd] = prefix;
			namespaceUri[namespaceEnd] = namespace;
			++namespaceEnd;

			return prefix;
		}
	}
1341142
def _parse_key(self, indent):
        """"""
        data = {}

        new_indent = indent
        while not self._finished and new_indent == indent:
            self._skip_whitespace()
            cur_token = self._cur_token
            if cur_token['type'] is TT.id:
                key = cur_token['value']
                next_token = self._nth_token()
                if next_token['type'] is TT.colon:
                    self._increment(2)  # move past the ':'
                    # whitespace before a newline is not important
                    # whitespace after a newline is important
                    self._skip_whitespace()
                    self._skip_newlines()
                    data[key] = self._parse_value()
                else:
                    raise ParseError("':'", next_token)
            else:
                if cur_token['type'] is TT.hyphen:
                    return data
                else:
                    raise ParseError("identifier or '-'", cur_token)

            if self.tokens[self._cur_position - 1]['type'] is not TT.lbreak:
                # skip whitespace at the end of the line
                self._skip_whitespace()
                self._skip_newlines()

            # find next indentation level without incrementing
            new_indent = 0
            temp_position = self._cur_position
            while (
                temp_position < self.num_tokens-1 and
                self.tokens[temp_position]['type'] is TT.ws
            ):
                temp_position += 1
                new_indent += 1

        if indent == 0 or new_indent < indent:
            return data
        else:
            raise Exception(
                "Parser screwed up, increase of indent on line {} should "
                "have been caught by _parse_value().".format(
                    cur_token['line']
                )
            )