예제 #1
0
        public object Contains(object o)
        {
            // promote sets to FrozenSet's for contains checks (so we get a hash code)
            o = SetHelpers.GetHashableSetIfSet(o);

            Ops.Hash(o);// make sure we have a hashable item
            return(Ops.Bool2Object(items.ContainsKey(o)));
        }
예제 #2
0
파일: Set.cs 프로젝트: rudimk/dlr-dotnet
        public void remove([NotNull] SetCollection o)
        {
            var set = SetHelpers.GetHashableSetIfSet(o);

            if (!_items.RemoveAlwaysHash(set))
            {
                throw PythonOps.KeyError(o);
            }
        }
예제 #3
0
파일: Set.cs 프로젝트: rudimk/dlr-dotnet
        public bool __contains__(object value)
        {
            // promote sets to FrozenSets for contains checks (so we get a hash code)
            value = SetHelpers.GetHashableSetIfSet(value);

            if (_items.Count == 0)
            {
                PythonOps.Hash(DefaultContext.Default, value);    // make sure we have a hashable item
            }
            return(_items.Contains(value));
        }
예제 #4
0
        public void Remove(object o)
        {
            o = SetHelpers.GetHashableSetIfSet(o);

            Ops.Hash(o);
            if (!items.ContainsKey(o))
            {
                throw Ops.KeyError("{0}", o.ToString());
            }

            items.Remove(o);
        }
예제 #5
0
        public void Discard(object o)
        {
            o = SetHelpers.GetHashableSetIfSet(o);

            items.Remove(o);
        }