Check if an object is a sequence.
499008
def is_seq(obj):
    
    return (not is_str(obj) and not is_dict(obj) and
            (hasattr(obj, "__getitem__") or hasattr(obj, "__iter__")))
648496
function is(obj, type) {
      if (!type) {
        return obj !== undefined;
      }

      if (type == 'array' && Arr.isArray(obj)) {
        return true;
      }

      return typeof obj == type;
    }
582646
function isPrimitiveType (obj) {
  return ( typeof obj === 'boolean' ||
       typeof obj === 'number' ||
       typeof obj === 'string' ||
       obj === null ||
       util.isDate(obj) ||
       util.isArray(obj));
}
1104256
def ensure_list(value: Union[T, Sequence[T]]) -> Sequence[T]:
    """"""
    if value is None:
        return []
    return value if isinstance(value, list) else [value]
1240581
function Sequence (opts) {
    if (opts.actions) {
        return initWithActions(Object.getPrototypeOf(this).constructor, opts.actions)
    }

    if (!opts.one) {
        throw "Sequence argument one must be non-nil"
    }
    if (!opts.two) {
        throw "Sequence argument two must be non-nil"
    }
    this.actions = []

    var d = opts.one.duration + opts.two.duration

    Sequence.superclass.constructor.call(this, {duration: d})

    this.actions[0] = opts.one
    this.actions[1] = opts.two
}
330824
def is_series(obj):
    
    try:
        # This is the best method of type checking
        from pandas import Series
        return isinstance(obj, Series)
    except ImportError:
        # Pandas is not a dependency, so this is scary
        return obj.__class__.__name__ == "Series"
1093951
def check_valid_object_name(sequence):
    """"""
    names = []
    for o in sequence:
        if o.__name__ in names:
            raise ValueError(
                'A tallyable PyMC object called %s already exists. This will cause problems for some database backends.' %
                o.__name__)
        else:
            names.append(o.__name__)
1067982
def is_lazy_iterable(obj):
    
    return isinstance(obj,
        (types.GeneratorType, collections.MappingView, six.moves.range, enumerate))
1107045
function isMap(obj) {
    return (obj && typeof obj === OBJECT && !(typeof obj.length === NUMBER && !(obj.propertyIsEnumerable(LENGTH))));
  }
697045
boolean isTask(int sequence) {
        int index = toIndex(sequence);
        checkSequence(index, sequence);
        return isTask[index];
    }
1357763
function isArray(obj) {
    return (obj && typeof obj === OBJECT && typeof obj.length === NUMBER && !(obj.propertyIsEnumerable(LENGTH)));
  }
294019
def filter_by(self, types=(), units=()):
        """"""
        if not (isinstance(types, Sequence) and isinstance(units, Sequence)):
            raise TypeError('types/units must be a sequence')
        empty = frozenset()

        if types:
            type_names = set()
            for type_ in types:
                type_names |= self.by_type.get(type_, empty)
            if not units:
                return type_names

        if units:
            unit_names = set()
            for unit in units:
                unit_names |= self.by_unit.get(unit, empty)
            if not types:
                return unit_names

        return (type_names & unit_names) if (types and units) else empty
14192
def is_listish(obj):
    """"""
    if isinstance(obj, (list, tuple, set)):
        return True
    return is_sequence(obj)
382146
def is_of_types(obj, the_types):
    '''
    
    '''
    if not isinstance(obj, the_types):
        raise KittyException('object type (%s) is not one of (%s)' % (type(obj), the_types))
423249
def is_number(obj):
    
    try:
        from numbers import Number
    except ImportError:
        from operator import isNumberType
        return isNumberType(obj)
    else:
        return isinstance(obj, Number)
1172376
def _check_model(obj, models=None):
    """"""
    return isinstance(obj, type) and issubclass(obj, pw.Model) and hasattr(obj, '_meta')
50909
def match_sequence(self, tokens, item):
        """"""
        tail = None
        if len(tokens) == 2:
            series_type, matches = tokens
        else:
            series_type, matches, tail = tokens
        self.add_check("_coconut.isinstance(" + item + ", _coconut.abc.Sequence)")
        if tail is None:
            self.add_check("_coconut.len(" + item + ") == " + str(len(matches)))
        else:
            self.add_check("_coconut.len(" + item + ") >= " + str(len(matches)))
            if tail != wildcard:
                if len(matches) > 0:
                    splice = "[" + str(len(matches)) + ":]"
                else:
                    splice = ""
                self.assign_to_series(tail, series_type, item + splice)
        self.match_all_in(matches, item)