// YN y/n choice
330934
func YN(message string, yes bool) bool {
	defaultChoice := "n"
	if yes {
		defaultChoice = "y"
	}
	input := (&Prompter{
		Message:    message,
		Choices:    []string{"y", "n"},
		IgnoreCase: true,
		Default:    defaultChoice,
	}).Prompt()

	return strings.ToLower(input) == "y"
}
191920
func choose(n, k int) int {
	if k == 0 {
		return 1
	} else if n == 0 {
		return 0
	}
	result := float32(n - (k - 1))
	for i := 2; i <= k; i++ {
		result *= float32(n-(k-i)) / float32(i)
	}

	return int(result)
}
1169089
func (s *NetworkOfferingService) GetNetworkOfferingByID(id string, opts ...OptionFunc) (*NetworkOffering, int, error) {
	p := &ListNetworkOfferingsParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListNetworkOfferings(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.NetworkOfferings[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for NetworkOffering UUID: %s!", id)
}
235156
func (h *HCI) Option(opts ...Option) error {
	var err error
	for _, opt := range opts {
		err = opt(h)
	}
	return err
}
635984
func (s *Statistics) N() uint64 {
	s.RLock()
	defer s.RUnlock()
	return s.samples
}
372730
func (s *stack) PickN(n int32) error {
	so, err := s.PeekByteArray(n)
	if err != nil {
		return err
	}
	s.PushByteArray(so)

	return nil
}
434137
func No(s string) bool {
	s = strings.ToLower(s)
	_, ok := no[s]
	return ok
}
911146
func (w WriteOptions) String() string {
	f := []string{}
	for _, on := range optNames {
		if w&on.opt != 0 {
			f = append(f, on.name)
			w &= ^on.opt
		}
	}
	if len(f) == 0 || w != 0 {
		f = append(f, fmt.Sprintf("0x%x", int(w)))
	}
	return strings.Join(f, "|")
}
1160133
func Confirmer(defaultYes bool) Func {
	return func(input string) error {
		if defaultYes {
			if input == "" || input == "y" || input == "N" {
				return nil
			}

			return NewValidationError("You must specify either 'y' for yes or 'N' for no.")
		}

		if input == "" || input == "Y" || input == "n" {
			return nil
		}

		return NewValidationError("You must specify either 'Y' for yes or 'n' for no.")
	}
}
1048542
func (s *NetworkService) GetNetworkByID(id string, opts ...OptionFunc) (*Network, int, error) {
	p := &ListNetworksParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListNetworks(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.Networks[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for Network UUID: %s!", id)
}
104550
func (z *ConstNumber) AndNot(x, y *ConstNumber) *ConstNumber {
	z.Type = promoteConstNumbers(x.Type, y.Type)
	z.Value.Re.Num().AndNot(x.Value.Re.Num(), y.Value.Re.Num())
	return z
}
1339792
func (n *Namespace) Ne(x, y interface{}) bool {
	return !n.Eq(x, y)
}
44430
func strIn(a string, set []string) bool {
	for _, s := range set {
		if s == a {
			return true
		}
	}
	return false
}
981461
func (yn *YesOrNo) Set(v string) error {
	switch v {
	case "yes":
		*yn = true
	case "no":
		*yn = false
	default:
		return errors.New("expecting 'yes' or 'no'")
	}
	return nil
}
137880
def yn_choice(message, default='y', tries=None):
    
    # http://stackoverflow.com/questions/3041986/python-command-line-yes-no-input"""
    choices = 'Y/n' if default.lower() in ('y', 'yes') else 'y/N'
    if tries is None:
        choice = input("%s (%s) " % (message, choices))
        values = ('y', 'yes', '') if default == 'y' else ('y', 'yes')
        return True if choice.strip().lower() in values else False
    else:
        while tries > 0:
            choice = input(
                "%s (%s) (%s)" % (message, choices, "'q' to discard"))
            choice = choice.strip().lower()
            if choice in ['y', 'yes']:
                return True
            elif choice in ['n', 'no', 'q']:
                return False
            else:
                print("Invalid input...")
                tries -= 1
518741
func Cyan(arg interface{}) Value {
	if val, ok := arg.(Value); ok {
		return val.Cyan()
	}
	return value{value: arg, color: CyanFg}
}
1231952
func unionN(l []*Automaton) *Automaton {
	ans := newEmptyAutomaton()
	// create initial state
	ans.createState()
	// copy over all automata
	for _, a := range l {
		ans.copy(a)
	}
	// add epsilon transition from new initial state
	stateOffset := 1
	for _, a := range l {
		if a.numStates() == 0 {
			continue
		}
		ans.addEpsilon(0, stateOffset)
		stateOffset += a.numStates()
	}
	ans.finishState()
	return removeDeadStates(ans)
}