// DidUnarchiveCard returns true if the card was unarchived
197931
func (a *Action) DidUnarchiveCard() bool {
	return (a.Type == "updateCard") && a.Data != nil && a.Data.Old != nil && a.Data.Old.Closed
}
172435
func (gce *Cloud) DeleteDisk(diskToDelete string) error {
	err := gce.doDeleteDisk(diskToDelete)
	if isGCEError(err, "resourceInUseByAnotherResource") {
		return volume.NewDeletedVolumeInUseError(err.Error())
	}

	if err == cloudprovider.ErrDiskNotFound {
		return nil
	}
	return err
}
866273
func IsLuhnValid(card string) (bool, error) {

	var sum = 0
	var digits = strings.Split(card, "")

	// iterate through the digits in reverse order
	for i, even := len(digits)-1, false; i >= 0; i, even = i-1, !even {

		// convert the digit to an integer
		digit, err := strconv.Atoi(digits[i])
		if err != nil {
			return false, err
		}

		// we multiply every other digit by 2, adding the product to the sum.
		// note: if the product is double digits (i.e. 14) we add the two digits
		//       to the sum (14 -> 1+4 = 5). A simple shortcut is to subtract 9
		//       from a double digit product (14 -> 14 - 9 = 5).
		switch {
		case even && digit > 4:
			sum += (digit * 2) - 9
		case even:
			sum += digit * 2
		case !even:
			sum += digit
		}
	}

	// if the sum is divisible by 10, it passes the check
	return sum%10 == 0, nil
}
1057825
func CreditCard() *CreditCardInfo {
	return &CreditCardInfo{
		Type:   CreditCardType(),
		Number: CreditCardNumber(),
		Exp:    CreditCardExp(),
		Cvv:    CreditCardCvv(),
	}
}
389809
func (d *RecipientTransferDestination) UnmarshalJSON(data []byte) error {
	if id, ok := ParseID(data); ok {
		d.ID = id
		return nil
	}

	type recipientTransferDestination RecipientTransferDestination
	var v recipientTransferDestination
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}

	var err error
	*d = RecipientTransferDestination(v)

	switch d.Type {
	case RecipientTransferDestinationBankAccount:
		err = json.Unmarshal(data, &d.BankAccount)
	case RecipientTransferDestinationCard:
		err = json.Unmarshal(data, &d.Card)
	}

	return err
}
223828
func (s *Slot) SetResponseCard(v string) *Slot {
	s.ResponseCard = &v
	return s
}
1175597
func (s *SelectStatement) HasFieldWildcard() (hasWildcard bool) {
	WalkFunc(s.Fields, func(n Node) {
		if hasWildcard {
			return
		}
		switch n.(type) {
		case *Wildcard, *RegexLiteral:
			hasWildcard = true
		}
	})
	return hasWildcard
}
157724
func (c ActionCollection) FirstCardCreateAction() *Action {
	sort.Sort(c)
	for _, action := range c {
		if action.DidCreateCard() {
			return action
		}
	}
	return nil
}
292313
func (n *EndpointSelector) IsWildcard() bool {
	return n.LabelSelector != nil &&
		len(n.LabelSelector.MatchLabels)+len(n.LabelSelector.MatchExpressions) == 0
}
1322583
func (tbz2 *TarBz2) Unarchive(source, destination string) error {
	tbz2.wrapReader()
	return tbz2.Tar.Unarchive(source, destination)
}
564057
func (devices *DeviceSet) issueDiscard(info *devInfo) error {
	logrus.Debugf("devmapper: issueDiscard START(device: %s).", info.Hash)
	defer logrus.Debugf("devmapper: issueDiscard END(device: %s).", info.Hash)
	// This is a workaround for the kernel not discarding block so
	// on the thin pool when we remove a thinp device, so we do it
	// manually.
	// Even if device is deferred deleted, activate it and issue
	// discards.
	if err := devices.activateDeviceIfNeeded(info, true); err != nil {
		return err
	}

	devinfo, err := devicemapper.GetInfo(info.Name())
	if err != nil {
		return err
	}

	if devinfo.OpenCount != 0 {
		logrus.Debugf("devmapper: Device: %s is in use. OpenCount=%d. Not issuing discards.", info.Hash, devinfo.OpenCount)
		return nil
	}

	if err := devicemapper.BlockDeviceDiscard(info.DevName()); err != nil {
		logrus.Debugf("devmapper: Error discarding block on device: %s (ignoring)", err)
	}
	return nil
}
1344536
func HasNoPager(ctx context.Context) bool {
	_, ok := ctx.Value(ctxKeyNoPager).(bool)
	return ok
}
111464
func (c *Client) GetCreditCard(id string) (*CreditCard, error) {
	req, err := c.NewRequest("GET", fmt.Sprintf("%s/v1/vault/credit-cards/%s", c.APIBase, id), nil)
	if err != nil {
		return nil, err
	}

	response := CreditCard{}

	if err = c.SendWithAuth(req, &response); err != nil {
		return nil, err
	}

	return &response, nil
}
532273
func (s *ValidateService) AnalyzeWildcard(analyzeWildcard bool) *ValidateService {
	s.analyzeWildcard = &analyzeWildcard
	return s
}
760988
func (h *Hash) CanHaveDefault() bool {
	return h.KeyType.Type.CanHaveDefault() && h.ElemType.Type.CanHaveDefault()
}
234625
func (l VirtualDeviceList) CreateEthernetCard(name string, backing types.BaseVirtualDeviceBackingInfo) (types.BaseVirtualDevice, error) {
	ctypes := EthernetCardTypes()

	if name == "" {
		name = ctypes.deviceName(ctypes[0])
	}

	found := ctypes.Select(func(device types.BaseVirtualDevice) bool {
		return l.deviceName(device) == name
	})

	if len(found) == 0 {
		return nil, fmt.Errorf("unknown ethernet card type '%s'", name)
	}

	c, ok := found[0].(types.BaseVirtualEthernetCard)
	if !ok {
		return nil, fmt.Errorf("invalid ethernet card type '%s'", name)
	}

	c.GetVirtualEthernetCard().Backing = backing

	return c.(types.BaseVirtualDevice), nil
}
120134
func (s *ChannelsService) Unarchive(channel string) *ChannelsUnarchiveCall {
	var call ChannelsUnarchiveCall
	call.service = s
	call.channel = channel
	return &call
}