Exemplo n.º 1
0
        internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value)
        {
            if (instance == null)
            {
                value = new DictProxy(owner);
                return(true);
            }

            PythonType pt = instance as PythonType;

            if (pt != null)
            {
                value = new DictProxy(pt);
                return(true);
            }

            IPythonObject sdo = instance as IPythonObject;

            if (sdo != null && sdo.PythonType.HasDictionary)
            {
                PythonDictionary res = sdo.Dict;
                if (res != null || (res = sdo.SetDict(sdo.PythonType.MakeDictionary())) != null)
                {
                    value = res;
                    return(true);
                }
            }

            value = null;
            return(false);
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            DictProxy proxy = obj as DictProxy;

            if (proxy == null)
            {
                return(false);
            }

            return(proxy._dt == _dt);
        }