It provide a root descriptor to be used inside a with statement. It
    automatically close the root when the with statement finish.

    Keyword arguments:
    root -- the root descriptor returned by the 'open' function
546735
def loader(pattern, dimensions=None, distributed_dim='time', read_only=False):
    
    if dimensions:
        root = tailor(pattern, dimensions, distributed_dim, read_only=read_only)
    else:
        root, _ = open(pattern, read_only=read_only)
    yield root
    root.close()
540887
def root(self):
        
        sector = self.header.directory_sector_start
        position = (sector + 1) << self.header.sector_shift
        return RootEntry(self, position)
1321587
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) {
    // Find the root of the field access chain, i.e. a.intern().trim() ==> a.
    ExpressionTree identifierExpr = ASTHelpers.getRootAssignable(methodInvocationTree);
    String identifierStr = null;
    Type identifierType = null;
    if (identifierExpr != null) {
      identifierStr = state.getSourceForNode(identifierExpr);
      if (identifierExpr instanceof JCIdent) {
        identifierType = ((JCIdent) identifierExpr).sym.type;
      } else if (identifierExpr instanceof JCFieldAccess) {
        identifierType = ((JCFieldAccess) identifierExpr).sym.type;
      } else {
        throw new IllegalStateException("Expected a JCIdent or a JCFieldAccess");
      }
    }

    Type returnType = getReturnType(((JCMethodInvocation) methodInvocationTree).getMethodSelect());

    Fix fix;
    if (identifierStr != null
        && !"this".equals(identifierStr)
        && returnType != null
        && state.getTypes().isAssignable(returnType, identifierType)) {
      // Fix by assigning the assigning the result of the call to the root receiver reference.
      fix = SuggestedFix.prefixWith(methodInvocationTree, identifierStr + " = ");
    } else {
      // Unclear what the programmer intended.  Delete since we don't know what else to do.
      Tree parent = state.getPath().getParentPath().getLeaf();
      fix = SuggestedFix.delete(parent);
    }
    return describeMatch(methodInvocationTree, fix);
  }
1228130
def write_tree_newick(self, filename, hide_rooted_prefix=False):
        '''
        '''
        if not isinstance(filename, str):
            raise TypeError("filename must be a str")
        treestr = self.newick()
        if hide_rooted_prefix:
            if treestr.startswith('[&R]'):
                treestr = treestr[4:].strip()
            else:
                warn("Specified hide_rooted_prefix, but tree was not rooted")
        if filename.lower().endswith('.gz'): # gzipped file
            f = gopen(expanduser(filename),'wb',9); f.write(treestr.encode()); f.close()
        else: # plain-text file
            f = open(expanduser(filename),'w'); f.write(treestr); f.close()
1256112
def root(element, element_id=nil, &block)
      if element && element.is_a?(NSString)
        element = NSMenu.alloc.initWithTitle(element)
      end
      super(element, element_id, &block)
    end
105760
def describe_root(record, root, indent=0, suppress_values=False):
    
    def format_node(n, extra=None, indent=0):
        """
        Depends on closure over `record` and `suppress_values`.

        Args:
          n (Evtx.Nodes.BXmlNode):
          extra (str):

        Returns:
          str:
        """
        ret = ""
        indent_s = '  ' * indent
        name = n.__class__.__name__
        offset = n.offset() - record.offset()
        if extra is not None:
            ret = "%s%s(offset=%s, %s)" % (indent_s, name, hex(offset), extra)
        else:
            ret = "%s%s(offset=%s)" % (indent_s, name, hex(offset))

        if not suppress_values and isinstance(n, VariantTypeNode):
            ret += " --> %s" % (n.string())
            if isinstance(n, BXmlTypeNode):
                ret += "\n"
                ret += describe_root(record, n._root, indent=indent + 1)

        return ret

    def rec(node, indent=0):
        """
        Args:
          node (Evtx.Nodes.BXmlNode):
          indent (int):

        Returns:
          str:
        """
        ret = ""
        if isinstance(node, TemplateInstanceNode):
            if node.is_resident_template():
                extra = "resident=True, length=%s" % (hex(node.template().data_length()))
                ret += "%s\n" % (format_node(node, extra=extra, indent=indent))
                ret += rec(node.template(), indent=indent + 1)
            else:
                ret += "%s\n" % (format_node(node, extra="resident=False", indent=indent))
        else:
            ret += "%s\n" % (format_node(node, indent=indent))

        for child in node.children():
            ret += rec(child, indent=indent + 1)

        if isinstance(node, RootNode):
            ofs = node.tag_and_children_length()
            indent_s = '  ' * (indent + 1)
            offset = node.offset() - record.offset() + ofs
            ret += "%sSubstitutions(offset=%s)\n" % (indent_s, hex(offset))
            for sub in node.substitutions():
                ret += "%s\n" % (format_node(sub, indent=indent + 2))

        return ret

    ret = ""
    ret += rec(root, indent=indent)
    return ret
557883
def program(self):
        
        root = Program()

        while self.token.nature != Nature.EOF:
            root.children.append(self.statement())

        return root
1276051
def root(path: Union[str, pathlib.Path]) -> _Root:
    
    return _Root.from_path(_normalise_path(path))
941441
def root_namespace(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "root_namespace", value)
        self.__root_namespace = value
636688
def get_node(self, index):
        

        if not index.isValid():
            return self.__root_node
        return index.internalPointer() or self.__root_node
208433
function( callback ) {

    var self = this

    // Close a previously opened handle
    if( this.fd != null ) {
      return this.close( function( error ) {
        if( error != null )
          return callback.call( self, error )
        self.open( callback )
      })
    }

    // Open a new fd handle
    debug( 'fs:open', this.mode, this.path )
    this.fs.open( this.path, this.mode, function( error, fd ) {

      if( error != null )
        return callback.call( self, error, fd )

      // Set file descriptor
      self.fd = fd

      // If no blockSize has been set, attempt to
      // detect it after opening the device
      if( self.blockSize == null || self.blockSize <= 0 ) {
        self.detectBlockSize( 0, 0, 0, function( error, blockSize ) {
          self.blockSize = blockSize || -1
          callback.call( self, error, self.fd )
        })
      } else {
        callback.call( self, error, fd )
      }

    })

    return this

  }
784752
function depth(root) {
	let i = 0;
	let walker = document.createTreeWalker(root, 0xFFFFFFFF, {
		acceptNode: function(node){
			let nt = node.nodeType;
			return nt === 1 || nt === 3;
		}
	});

	while(walker.nextNode()) {
		i++;
	}
	return i;
}
471285
def root(self):
            
            str_treeRoot                = '/'
            self.l_cwd                  = [str_treeRoot]
            self.snode_current          = self.snode_root
            self.sbranch_current        = self.sbranch_root
440404
def root_frame(self, trim_stem=True):
        ''' 
        
        '''
        root_frame = None

        frame_stack = []

        for frame_tuple in self.frame_records:
            identifier_stack = frame_tuple[0]
            time = frame_tuple[1]

            # now we must create a stack of frame objects and assign this time to the leaf
            for stack_depth, frame_identifier in enumerate(identifier_stack):
                if stack_depth < len(frame_stack):
                    if frame_identifier != frame_stack[stack_depth].identifier:
                        # trim any frames after and including this one
                        del frame_stack[stack_depth:]

                if stack_depth >= len(frame_stack):
                    frame = Frame(frame_identifier)
                    frame_stack.append(frame)
                    
                    if stack_depth == 0:
                        # There should only be one root frame, as far as I know
                        assert root_frame is None, ASSERTION_MESSAGE
                        root_frame = frame
                    else:
                        parent = frame_stack[stack_depth-1]
                        parent.add_child(frame)

            # trim any extra frames
            del frame_stack[stack_depth+1:]  # pylint: disable=W0631

            # assign the time to the final frame
            frame_stack[-1].add_child(SelfTimeFrame(self_time=time))
        
        if root_frame is None:
            return None
        
        if trim_stem:
            root_frame = self._trim_stem(root_frame)
        
        return root_frame
387204
def enter_root(self, root):
        '''
        
        '''
        # There is no collision protection on root name isolation
        if root:
            self.result[root] = self.focus = {}
        else:
            self.focus = self.result
287824
function resolveInRoot(root) {
    var input, result;
    var args = Array.prototype.slice.call(arguments, 1);

    input = args
        .reduce(function(current, p) {
            // Handle path relative to book root ("/README.md")
            if (p[0] == '/' || p[0] == '\\') return p.slice(1);

            return current? path.join(current, p) : path.normalize(p);
        }, '');

    result = path.resolve(root, input);

    if (!isInRoot(root, result)) {
        throw new error.FileOutOfScopeError({
            filename: result,
            root: root
        });
    }

    return result;
}
1211165
def root(self):
        ''''''
        with self._mutex:
            if self._parent:
                return self._parent.root
            else:
                return self