Esempio n. 1
0
 public string /*!*/ __repr__(CodeContext /*!*/ context)
 {
     return(String.Format("<cell at {0}: {1}>",
                          IdDispenser.GetId(this),
                          GetContentsRepr()
                          ));
 }
Esempio n. 2
0
        private int CompareToWorker(List l)
        {
            // we need to lock both objects (or copy all of one's data w/ it's lock held, and
            // then compare, which is bad).  Therefore we have a strong order for locking on
            // the lists
            int result;

            if (this.GetHashCode() < l.GetHashCode())
            {
                lock (this) lock (l) result = Ops.CompareArrays(data, size, l.data, l.size);
            }
            else if (this.GetHashCode() != l.GetHashCode())
            {
                lock (l) lock (this) result = Ops.CompareArrays(data, size, l.data, l.size);
            }
            else
            {
                // rare, but possible.  We need a second opinion
                if (IdDispenser.GetId(this) < IdDispenser.GetId(l))
                {
                    lock (this) lock (l) result = Ops.CompareArrays(data, size, l.data, l.size);
                }
                else
                {
                    lock (l) lock (this) result = Ops.CompareArrays(data, size, l.data, l.size);
                }
            }
            return(result);
        }
Esempio n. 3
0
        private string GetContentsRepr()
        {
            if (Value == Uninitialized.Instance)
            {
                return("empty");
            }

            return($"{PythonTypeOps.GetName(Value)} object at 0x{IdDispenser.GetId(Value):X}");
        }
Esempio n. 4
0
        private string GetContentsRepr()
        {
            if (Value == Uninitialized.Instance)
            {
                return("empty");
            }

            return(String.Format("{0} object at {1}",
                                 PythonTypeOps.GetName(Value),
                                 IdDispenser.GetId(Value)));
        }
Esempio n. 5
0
        public virtual string /*!*/ __repr__(CodeContext /*!*/ context)
        {
            if (_func is BuiltinFunction bf)
            {
                return(String.Format("<method {0} of {1} objects>",
                                     PythonOps.Repr(context, bf.Name),
                                     PythonOps.Repr(context, DynamicHelpers.GetPythonTypeFromType(bf.DeclaringType).Name)));
            }

            return(String.Format("<classmethod object at {0}>",
                                 IdDispenser.GetId(this)));
        }
Esempio n. 6
0
 public WeakRefTracker(IWeakReferenceable target)
 {
     _targetId = IdDispenser.GetId(target);
 }
Esempio n. 7
0
 public string /*!*/ __repr__(CodeContext /*!*/ context)
 => $"<cell at 0x{IdDispenser.GetId(this):X}: {GetContentsRepr()}>";