// GetForkRepos returns the ForkRepos field if it's non-nil, zero value otherwise.
348053
func (r *RepoStats) GetForkRepos() int {
	if r == nil || r.ForkRepos == nil {
		return 0
	}
	return *r.ForkRepos
}
289247
func GetProtectBranchesByRepoID(repoID int64) ([]*ProtectBranch, error) {
	protectBranches := make([]*ProtectBranch, 0, 2)
	return protectBranches, x.Where("repo_id = ? and protected = ?", repoID, true).Asc("name").Find(&protectBranches)
}
3090
func (u *User) GetPublicRepos() int {
	if u == nil || u.PublicRepos == nil {
		return 0
	}
	return *u.PublicRepos
}
1342813
func getDiscordForkPayload(p *api.ForkPayload) (*DiscordPayload, error) {
	baseLink := DiscordLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
	forkLink := DiscordLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
	content := fmt.Sprintf("%s is forked to %s", baseLink, forkLink)
	return &DiscordPayload{
		Embeds: []*DiscordEmbedObject{{
			Description: content,
			URL:         setting.AppURL + p.Sender.UserName,
			Author: &DiscordEmbedAuthorObject{
				Name:    p.Sender.UserName,
				IconURL: p.Sender.AvatarUrl,
			},
		}},
	}, nil
}
356388
func (actor Actor) getPluginInfoFromRepositoryForPlatform(pluginName string, pluginRepo configv3.PluginRepository, platform string) (PluginInfo, error) {
	pluginRepository, err := actor.client.GetPluginRepository(pluginRepo.URL)
	if err != nil {
		return PluginInfo{}, err
	}

	var pluginFoundWithIncompatibleBinary bool

	for _, plugin := range pluginRepository.Plugins {
		if plugin.Name == pluginName {
			for _, pluginBinary := range plugin.Binaries {
				if pluginBinary.Platform == platform {
					return PluginInfo{
						Name:     plugin.Name,
						Version:  plugin.Version,
						URL:      pluginBinary.URL,
						Checksum: pluginBinary.Checksum,
					}, nil
				}
			}
			pluginFoundWithIncompatibleBinary = true
		}
	}

	if pluginFoundWithIncompatibleBinary {
		return PluginInfo{}, actionerror.NoCompatibleBinaryError{}
	}

	return PluginInfo{}, actionerror.PluginNotFoundInRepositoryError{
		PluginName:     pluginName,
		RepositoryName: pluginRepo.Name,
	}
}
1131695
func (c *Configuration) GetsPerPromote(count int32) *Configuration {
	c.getsPerPromote = count
	return c
}
426208
func getSlackForkPayload(p *api.ForkPayload) (*SlackPayload, error) {
	baseLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
	forkLink := SlackLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
	text := fmt.Sprintf("%s is forked to %s", baseLink, forkLink)
	return &SlackPayload{
		Text: text,
	}, nil
}
817991
func (r *RepoStats) GetTotalRepos() int {
	if r == nil || r.TotalRepos == nil {
		return 0
	}
	return *r.TotalRepos
}
66966
func (c *ClassifierDeserializer) GetU64ForKey(key string) (uint64, error) {
	b, err := c.GetBytesForKey(key)
	if err != nil {
		return 0, err
	}
	return UnpackBytesToU64(b), nil
}
116900
func GetFromKubeProxyConfigMap(client clientset.Interface, version *version.Version) (runtime.Object, error) {

	// Read the ConfigMap from the cluster
	kubeproxyCfg, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(kubeadmconstants.KubeProxyConfigMap, metav1.GetOptions{})
	if err != nil {
		return nil, err
	}

	kubeproxyConfigData, ok := kubeproxyCfg.Data[kubeadmconstants.KubeProxyConfigMapKey]
	if !ok {
		return nil, errors.Errorf("unexpected error when reading %s ConfigMap: %s key value pair missing",
			kubeadmconstants.KubeProxyConfigMap, kubeadmconstants.KubeProxyConfigMapKey)
	}

	// Decodes the Config map dat into the internal component config
	obj := &kubeproxyconfig.KubeProxyConfiguration{}
	err = unmarshalObject(obj, []byte(kubeproxyConfigData))
	if err != nil {
		return nil, err
	}

	return obj, nil
}
590009
func (ctx *protoKeyIterator) GetNext() (key string, rev int64, stop bool) {
	return ctx.delegate.GetNext()
}
824197
func (c *Cluster) GetPrevRegionByKey(key []byte) (*metapb.Region, *metapb.Peer) {
	c.RLock()
	defer c.RUnlock()

	currentRegion, _ := c.GetRegionByKey(key)
	if len(currentRegion.StartKey) == 0 {
		return nil, nil
	}
	for _, r := range c.regions {
		if bytes.Equal(r.Meta.EndKey, currentRegion.StartKey) {
			return proto.Clone(r.Meta).(*metapb.Region), proto.Clone(r.leaderPeer()).(*metapb.Peer)
		}
	}
	return nil, nil
}
1078468
func (b *Bucket) GetReplica(key string, valuePtr interface{}, replicaIdx int) (Cas, error) {
	return b.getReplica(key, valuePtr, replicaIdx)
}
549084
func (stub *MockStub) GetHistoryForKey(key string) (HistoryQueryIteratorInterface, error) {
	return nil, errors.New("not implemented")
}
556402
func (b *BlockOpsStandard) Get(ctx context.Context, kmd libkey.KeyMetadata,
	blockPtr data.BlockPointer, block data.Block, lifetime data.BlockCacheLifetime) error {
	// Check the journal explicitly first, so we don't get stuck in
	// the block-fetching queue.
	if journalBServer, ok := b.config.BlockServer().(journalBlockServer); ok {
		data, serverHalf, found, err := journalBServer.getBlockFromJournal(
			ctx, kmd.TlfID(), blockPtr.ID)
		if err != nil {
			return err
		}
		if found {
			return assembleBlock(
				ctx, b.config.keyGetter(), b.config.Codec(),
				b.config.cryptoPure(), kmd, blockPtr, block, data, serverHalf)
		}
	}

	b.log.LazyTrace(ctx, "BOps: Requesting %s", blockPtr.ID)

	errCh := b.queue.Request(
		ctx, defaultOnDemandRequestPriority, kmd,
		blockPtr, block, lifetime, b.config.Mode().DefaultBlockRequestAction())
	err := <-errCh

	b.log.LazyTrace(ctx, "BOps: Request fulfilled for %s (err=%v)", blockPtr.ID, err)

	return err
}
365449
func (b *Bucket) GetBulkRaw(keys []string) (map[string][]byte, error) {

	resp, eout := b.getBulk(keys, noDeadline, nil)

	rv := make(map[string][]byte, len(keys))
	for k, av := range resp {
		rv[k] = av.Body
	}

	b.ReleaseGetBulkPools(resp)
	return rv, eout

}
472090
func (s *GitServer) GetRepo(name string) (provider.Repo, error) {
	r := &Repo{}
	repo, _, err := s.client.Repositories.Get(s.ctx, s.username, name)
	if err != nil {
		local.Printf("Unable to find repo [%s/%s]", s.username, name)
		return r, err
	}
	if repo == nil {
		return r, nil
	}
	r.impl = repo
	if *repo.Fork {
		r.forkedFrom = &Repo{impl: repo.Parent}
	}
	return r, nil
}