|
17 | 17 | from pandas.util.decorators import (Appender, cache_readonly, |
18 | 18 | deprecate_kwarg, Substitution) |
19 | 19 | from pandas.core.common import AbstractMethodError |
20 | | -from pandas.formats.printing import pprint_thing |
21 | 20 |
|
22 | 21 | _shared_docs = dict() |
23 | 22 | _indexops_doc_kwargs = dict(klass='IndexOpsMixin', inplace='', |
@@ -694,110 +693,6 @@ def _gotitem(self, key, ndim, subset=None): |
694 | 693 | return self |
695 | 694 |
|
696 | 695 |
|
697 | | -class FrozenList(PandasObject, list): |
698 | | - |
699 | | - """ |
700 | | - Container that doesn't allow setting item *but* |
701 | | - because it's technically non-hashable, will be used |
702 | | - for lookups, appropriately, etc. |
703 | | - """ |
704 | | - # Sidenote: This has to be of type list, otherwise it messes up PyTables |
705 | | - # typechecks |
706 | | - |
707 | | - def __add__(self, other): |
708 | | - if isinstance(other, tuple): |
709 | | - other = list(other) |
710 | | - return self.__class__(super(FrozenList, self).__add__(other)) |
711 | | - |
712 | | - __iadd__ = __add__ |
713 | | - |
714 | | - # Python 2 compat |
715 | | - def __getslice__(self, i, j): |
716 | | - return self.__class__(super(FrozenList, self).__getslice__(i, j)) |
717 | | - |
718 | | - def __getitem__(self, n): |
719 | | - # Python 3 compat |
720 | | - if isinstance(n, slice): |
721 | | - return self.__class__(super(FrozenList, self).__getitem__(n)) |
722 | | - return super(FrozenList, self).__getitem__(n) |
723 | | - |
724 | | - def __radd__(self, other): |
725 | | - if isinstance(other, tuple): |
726 | | - other = list(other) |
727 | | - return self.__class__(other + list(self)) |
728 | | - |
729 | | - def __eq__(self, other): |
730 | | - if isinstance(other, (tuple, FrozenList)): |
731 | | - other = list(other) |
732 | | - return super(FrozenList, self).__eq__(other) |
733 | | - |
734 | | - __req__ = __eq__ |
735 | | - |
736 | | - def __mul__(self, other): |
737 | | - return self.__class__(super(FrozenList, self).__mul__(other)) |
738 | | - |
739 | | - __imul__ = __mul__ |
740 | | - |
741 | | - def __reduce__(self): |
742 | | - return self.__class__, (list(self),) |
743 | | - |
744 | | - def __hash__(self): |
745 | | - return hash(tuple(self)) |
746 | | - |
747 | | - def _disabled(self, *args, **kwargs): |
748 | | - """This method will not function because object is immutable.""" |
749 | | - raise TypeError("'%s' does not support mutable operations." % |
750 | | - self.__class__.__name__) |
751 | | - |
752 | | - def __unicode__(self): |
753 | | - return pprint_thing(self, quote_strings=True, |
754 | | - escape_chars=('\t', '\r', '\n')) |
755 | | - |
756 | | - def __repr__(self): |
757 | | - return "%s(%s)" % (self.__class__.__name__, |
758 | | - str(self)) |
759 | | - |
760 | | - __setitem__ = __setslice__ = __delitem__ = __delslice__ = _disabled |
761 | | - pop = append = extend = remove = sort = insert = _disabled |
762 | | - |
763 | | - |
764 | | -class FrozenNDArray(PandasObject, np.ndarray): |
765 | | - |
766 | | - # no __array_finalize__ for now because no metadata |
767 | | - def __new__(cls, data, dtype=None, copy=False): |
768 | | - if copy is None: |
769 | | - copy = not isinstance(data, FrozenNDArray) |
770 | | - res = np.array(data, dtype=dtype, copy=copy).view(cls) |
771 | | - return res |
772 | | - |
773 | | - def _disabled(self, *args, **kwargs): |
774 | | - """This method will not function because object is immutable.""" |
775 | | - raise TypeError("'%s' does not support mutable operations." % |
776 | | - self.__class__) |
777 | | - |
778 | | - __setitem__ = __setslice__ = __delitem__ = __delslice__ = _disabled |
779 | | - put = itemset = fill = _disabled |
780 | | - |
781 | | - def _shallow_copy(self): |
782 | | - return self.view() |
783 | | - |
784 | | - def values(self): |
785 | | - """returns *copy* of underlying array""" |
786 | | - arr = self.view(np.ndarray).copy() |
787 | | - return arr |
788 | | - |
789 | | - def __unicode__(self): |
790 | | - """ |
791 | | - Return a string representation for this object. |
792 | | -
|
793 | | - Invoked by unicode(df) in py2 only. Yields a Unicode String in both |
794 | | - py2/py3. |
795 | | - """ |
796 | | - prepr = pprint_thing(self, escape_chars=('\t', '\r', '\n'), |
797 | | - quote_strings=True) |
798 | | - return "%s(%s, dtype='%s')" % (type(self).__name__, prepr, self.dtype) |
799 | | - |
800 | | - |
801 | 696 | class IndexOpsMixin(object): |
802 | 697 | """ common ops mixin to support a unified inteface / docs for Series / |
803 | 698 | Index |
|
0 commit comments