// GetTree fetches the Tree object for a given sha hash from a repository.
//
// GitHub API docs: https://developer.github.com/v3/git/trees/#get-a-tree
430117
func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
	if recursive {
		u += "?recursive=1"
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	t := new(Tree)
	resp, err := s.client.Do(ctx, req, t)
	if err != nil {
		return nil, resp, err
	}

	return t, resp, nil
}
1233010
func (ptree *ptree) Get(keys ...common.Comparator) common.Comparators {
	ga := newGetAction(keys)
	ptree.checkAndRun(ga)
	ga.completer.Wait()
	return ga.result
}
429668
func (n *node) GetBucket(tx *bolt.Tx, children ...string) *bolt.Bucket {
	var b *bolt.Bucket

	bucketNames := append(n.rootBucket, children...)
	for _, bucketName := range bucketNames {
		if b != nil {
			if b = b.Bucket([]byte(bucketName)); b == nil {
				return nil
			}
		} else {
			if b = tx.Bucket([]byte(bucketName)); b == nil {
				return nil
			}
		}
	}

	return b
}
329757
func (o *OrgsClient) GetTree(ctx context.Context, orgID identity.ID) ([]OrgTreeSegment, error) {
	v := &url.Values{}
	v.Set("org_id", orgID.String())

	var segments []OrgTreeSegment
	err := o.client.RoundTrip(ctx, "GET", "/orgtree", v, nil, &segments)
	return segments, err
}
1139013
func (ts *Store) GetImageHash(id string) (string, error) {
	treepath := ts.GetPath(id)

	imgHash, err := ioutil.ReadFile(filepath.Join(treepath, imagefilename))
	if err != nil {
		return "", errwrap.Wrap(errors.New("cannot read image file"), err)
	}

	return string(imgHash), nil
}
1235098
def get_tree_from_sha(self, ref):
        '''
        
        '''
        try:
            return self.repo.rev_parse(ref).tree
        except (gitdb.exc.ODBError, AttributeError):
            return None
1285493
func (s *Etcd) GetTree(directory string) ([]*store.KVPair, error) {
	getOpts := &etcd.GetOptions{
		Quorum:    true,
		Recursive: true,
		Sort:      true,
	}

	resp, err := s.client.Get(context.Background(), s.normalize(directory), getOpts)
	if err != nil {
		if keyNotFound(err) {
			return nil, store.ErrKeyNotFound
		}
		return nil, err
	}
	if !resp.Node.Dir { // it is a key, not a directory
		return []*store.KVPair{
			&store.KVPair{
				Key:       resp.Node.Key,
				Value:     []byte(resp.Node.Value),
				LastIndex: resp.Node.ModifiedIndex,
			},
		}, nil
	}

	return travelNodes(resp.Node.Nodes), nil
}
137351
func (t *Tree) GetPath(keys []string) interface{} {
	if len(keys) == 0 {
		return t
	}
	subtree := t
	for _, intermediateKey := range keys[:len(keys)-1] {
		value, exists := subtree.values[intermediateKey]
		if !exists {
			return nil
		}
		switch node := value.(type) {
		case *Tree:
			subtree = node
		case []*Tree:
			// go to most recent element
			if len(node) == 0 {
				return nil
			}
			subtree = node[len(node)-1]
		default:
			return nil // cannot navigate through other node types
		}
	}
	// branch based on final node type
	switch node := subtree.values[keys[len(keys)-1]].(type) {
	case *tomlValue:
		return node.value
	default:
		return node
	}
}
1251717
func (d *Database) Get(path string) *Node {
	d.mtx.RLock()
	defer d.mtx.RUnlock()

	current := d.root
	if path == "" {
		return current
	}

	rabbitHole := strings.Split(path, "/")
	for i := 0; i < len(rabbitHole); i++ {
		var ok bool
		current, ok = current.Children[rabbitHole[i]]
		if !ok {
			return nil
		}
	}
	return current
}
198015
func (t *Tree) Find(key interface{}) interface{} {
	if key != nil && t.root != nil {
		d := &findData{key, t.compare}
		node := d.finder(t.root)
		if node != nil {
			return node.value
		}
	}

	return nil
}
716402
func (t *Tree) Find(ctx context.Context, h Hash) (ret interface{}, root Hash, err error) {
	return t.findTyped(ctx, h, false)
}
613295
func (t *TreeEntry) GetSHA() string {
	if t == nil || t.SHA == nil {
		return ""
	}
	return *t.SHA
}
623039
func (s *Application) Tree(args ...*echo.Echo) (r map[string]map[string]map[string]map[string]string) {
	core := s.Core
	if len(args) > 0 {
		core = args[0]
	}
	nrs := core.NamedRoutes()
	rs := core.Routes()
	r = map[string]map[string]map[string]map[string]string{}
	for name, indexes := range nrs {
		p := strings.LastIndex(name, `/`)
		s := strings.Split(name[p+1:], `.`)
		var appName, ctlName, actName string
		switch len(s) {
		case 3:
			if !strings.HasSuffix(s[2], `-fm`) {
				continue
			}
			actName = strings.TrimSuffix(s[2], `-fm`)
			ctlName = strings.TrimPrefix(s[1], `(`)
			ctlName = strings.TrimPrefix(ctlName, `*`)
			ctlName = strings.TrimSuffix(ctlName, `)`)
			p2 := strings.LastIndex(name[0:p], `/`)
			appName = name[p2+1 : p]
		default:
			continue
		}
		if _, ok := r[appName]; !ok {
			r[appName] = map[string]map[string]map[string]string{}
		}
		if _, ok := r[appName][ctlName]; !ok {
			r[appName][ctlName] = map[string]map[string]string{}
		}
		if _, ok := r[appName][ctlName][actName]; !ok {
			r[appName][ctlName][actName] = map[string]string{}
			for _, index := range indexes {
				route := rs[index]
				if _, ok := r[appName][ctlName][actName][route.Method]; !ok {
					r[appName][ctlName][actName][route.Method] = route.Method
				}
			}
		}
	}
	return
}
1084091
func (c *Client) GitTrees(url *url.URL) (trees *GitTreesService) {
	trees = &GitTreesService{client: c, URL: url}
	return
}
1065166
func (csp *CSP) GetHash(opts bccsp.HashOpts) (h hash.Hash, err error) {
	// Validate arguments
	if opts == nil {
		return nil, errors.New("Invalid opts. It must not be nil.")
	}

	hasher, found := csp.Hashers[reflect.TypeOf(opts)]
	if !found {
		return nil, errors.Errorf("Unsupported 'HashOpt' provided [%v]", opts)
	}

	h, err = hasher.GetHash(opts)
	if err != nil {
		return nil, errors.Wrapf(err, "Failed getting hash function with opts [%v]", opts)
	}

	return
}
1267694
def get_tree_from_sha(self, ref):
        '''
        
        '''
        try:
            return self.repo.revparse_single(ref).tree
        except (KeyError, TypeError, ValueError, AttributeError):
            return None
1220607
func (node *Node) get(t *ImmutableTree, key []byte) (index int64, value []byte) {
	if node.isLeaf() {
		switch bytes.Compare(node.key, key) {
		case -1:
			return 1, nil
		case 1:
			return 0, nil
		default:
			return 0, node.value
		}
	}

	if bytes.Compare(key, node.key) < 0 {
		return node.getLeftNode(t).get(t, key)
	}
	rightNode := node.getRightNode(t)
	index, value = rightNode.get(t, key)
	index += node.size - rightNode.size
	return index, value
}