// rejectOutletPackages removes packages whose description or name contains the
// string "OUTLET".
551324
func rejectOutletPackages(packages []datatypes.Product_Package) []datatypes.Product_Package {
	selected := []datatypes.Product_Package{}

	for _, pkg := range packages {
		if (pkg.Name == nil || !strings.Contains(*pkg.Name, "OUTLET")) &&
			(pkg.Description == nil || !strings.Contains(*pkg.Description, "OUTLET")) {

			selected = append(selected, pkg)
		}
	}

	return selected
}
534373
func (i *ImportRestriction) forbiddenImportsFor(pkg Package) []string {
	forbiddenImportSet := map[string]struct{}{}
	for _, packageToCheck := range append(pkg.Imports, append(pkg.TestImports, pkg.XTestImports...)...) {
		if !i.isAllowed(packageToCheck) {
			forbiddenImportSet[relativePackage(packageToCheck)] = struct{}{}
		}
	}

	var forbiddenImports []string
	for imp := range forbiddenImportSet {
		forbiddenImports = append(forbiddenImports, imp)
	}
	return forbiddenImports
}
968175
func (r Network_Interconnect_Tenant) RejectApprovalRequests(serviceKey *string) (resp bool, err error) {
	params := []interface{}{
		serviceKey,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Interconnect_Tenant", "rejectApprovalRequests", params, &r.Options, &resp)
	return
}
686592
func (a *MandrillAPI) RejectsList(email string, includeExpired bool) ([]Reject, error) {
	var response []Reject
	if email == "" {
		return response, errors.New("email cannot be blank")
	}
	var params map[string]interface{} = make(map[string]interface{})
	params["email"] = email
	params["include_expired"] = includeExpired
	err := parseMandrillJson(a, rejects_list_endpoint, params, &response)
	return response, err
}
955530
func (s *renderedJobApplier) applyPackages(job models.Job) error {
	packageApplier := s.packageApplierProvider.JobSpecific(job.Name)

	for _, pkg := range job.Packages {
		err := packageApplier.Apply(pkg)
		if err != nil {
			return bosherr.WrapErrorf(err, "Applying package %s for job %s", pkg.Name, job.Name)
		}
	}

	err := packageApplier.KeepOnly(job.Packages)
	if err != nil {
		return bosherr.WrapErrorf(err, "Keeping only needed packages for job %s", job.Name)
	}

	return nil
}
645812
func (h *receivedPacketHandler) IgnoreBelow(pn protocol.PacketNumber) {
	h.oneRTTPackets.IgnoreBelow(pn)
}
1306003
func (c *Client) UpdatePackages() (string, error) {
	stdout, stderr, err := c.execNpm("update")
	if err != nil {
		return stdout, errors.New(stderr)
	}
	return stdout, nil
}
1352890
func (impl *repoImpl) setPackageHidden(c context.Context, r *api.PackageRequest, hidden bool) (resp *empty.Empty, err error) {
	defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()

	if err := common.ValidatePackageName(r.Package); err != nil {
		return nil, status.Errorf(codes.InvalidArgument, "bad 'package' - %s", err)
	}
	if _, err := impl.checkRole(c, r.Package, api.Role_OWNER); err != nil {
		return nil, err
	}

	switch err := model.SetPackageHidden(c, r.Package, hidden); {
	case err == datastore.ErrNoSuchEntity:
		return nil, status.Errorf(codes.NotFound, "no such package")
	case err != nil:
		return nil, errors.Annotate(err, "failed to update the package").Err()
	}
	return &empty.Empty{}, nil
}
771016
func (s *Switch) failAddPacket(packet *htlcPacket,
	failure lnwire.FailureMessage, failErr error) error {

	// Encrypt the failure so that the sender will be able to read the error
	// message. Since we failed this packet, we use EncryptFirstHop to
	// obfuscate the failure for their eyes only.
	reason, err := packet.obfuscator.EncryptFirstHop(failure)
	if err != nil {
		err := fmt.Errorf("unable to obfuscate "+
			"error: %v", err)
		log.Error(err)
		return err
	}

	log.Error(failErr)

	failPkt := &htlcPacket{
		sourceRef:      packet.sourceRef,
		incomingChanID: packet.incomingChanID,
		incomingHTLCID: packet.incomingHTLCID,
		circuit:        packet.circuit,
		htlc: &lnwire.UpdateFailHTLC{
			Reason: reason,
		},
	}

	// Route a fail packet back to the source link.
	err = s.mailOrchestrator.Deliver(failPkt.incomingChanID, failPkt)
	if err != nil {
		err = fmt.Errorf("source chanid=%v unable to "+
			"handle switch packet: %v",
			packet.incomingChanID, err)
		log.Error(err)
		return err
	}

	return failErr
}
1067442
func applyPackageSpecOverride(packageSpecs []PackageSpec, overrides []PackageSpecOverride, osDistro string) []PackageSpec {
	var override *PackageSpecOverride
	for _, o := range overrides {
		if o.OSDistro == osDistro {
			override = &o
			break
		}
	}
	if override == nil {
		return packageSpecs
	}

	// Remove packages in the spec that matches the overrides in
	// Subtractions.
	var out []PackageSpec
	subtractions := make(map[string]bool)
	for _, spec := range override.Subtractions {
		subtractions[spec.Name] = true
	}
	for _, spec := range packageSpecs {
		if _, ok := subtractions[spec.Name]; !ok {
			out = append(out, spec)
		}
	}

	// Add packages in the spec that matches the overrides in Additions.
	return append(out, override.Additions...)
}
660318
func (c *Conn) hideSetRequiredAcks(n int) error {
	switch n {
	case -1, 1:
		atomic.StoreInt32(&c.requiredAcks, int32(n))
		return nil
	default:
		return InvalidRequiredAcks
	}
}
1071860
func (s *UpdateInstanceProfileInput) SetPackageCleanup(v bool) *UpdateInstanceProfileInput {
	s.PackageCleanup = &v
	return s
}
1339567
func (l *Listener) rejectConn(err error) {
	select {
	case l.conns <- maybeConn{err: err}:
	case <-l.quit:
	}
}
144055
func (c *Client) ListPackages(filter *Filter) ([]Package, error) {
	var resp []Package
	req := request{
		method: client.GET,
		url:    apiPackages,
		filter: filter,
		resp:   &resp,
	}
	if _, err := c.sendRequest(req); err != nil {
		return nil, errors.Newf(err, "failed to get list of packages")
	}
	return resp, nil
}
656243
func PackJSONBytes(box string, name string, jbb string) error {
	var bb []byte
	err := json.Unmarshal([]byte(jbb), &bb)
	if err != nil {
		return err
	}
	PackBytes(box, name, bb)
	return nil
}
436574
func SetPackageHidden(c context.Context, pkg string, hidden bool) error {
	return Txn(c, "SetPackageHidden", func(c context.Context) error {
		p := &Package{Name: pkg}
		switch err := datastore.Get(c, p); {
		case err == datastore.ErrNoSuchEntity:
			return err
		case err != nil:
			return transient.Tag.Apply(err)
		case p.Hidden == hidden:
			return nil
		}

		p.Hidden = hidden
		if err := datastore.Put(c, p); err != nil {
			return transient.Tag.Apply(err)
		}

		ev := api.EventKind_PACKAGE_HIDDEN
		if !hidden {
			ev = api.EventKind_PACKAGE_UNHIDDEN
		}
		return EmitEvent(c, &api.Event{Kind: ev, Package: pkg})
	})
}
211140
func (g *Generator) TypeNameWithPackage(obj Object) string {
	return obj.PackageName() + CamelCaseSlice(obj.TypeName())
}