Repository: modin-project/modin

Issue:
PythonFrameManager:: _partitions_cache never created
part of on-going work for #74 

Type checker errored at:
```
modin/modin/engines/python/pandas_on_python/frame/partition_manager.py
  41:29 - error: Cannot access member '_partitions_cache' for type 'PythonFrameManager'
  Member '_partitions_cache' is unknown
  40:47 - error: Cannot access member '_partitions_cache' for type 'PythonFrameManager'
  Member '_partitions_cache' is unknown
  59:29 - error: Cannot access member '_partitions_cache' for type 'PythonFrameManager'
  Member '_partitions_cache' is unknown
  58:46 - error: Cannot access member '_partitions_cache' for type 'PythonFrameManager'
  Member '_partitions_cache' is unknown
```

Additionally, after doing a grep of `_partitions_cache` over the codebase, it was never assigned.

https://github.com/modin-project/modin/blob/6aac82bc06d8fd57d603d11ca62a966973839610/modin/engines/python/pandas_on_python/frame/partition_manager.py#L40

Should it be removed?


Discussion:
Thanks @simon-mo, you are correct that it is a deprecated field. It hasn't been caught because our unit tests don't test the metadata (maybe they should) and the Python backend is strictly for debugging. It should be removed.
Can you advise on what in particular is ok to be removed?, PythonFrameManager or just the caching mechanism?
The `block_widths` and `block_lengths` are calculated elsewhere. They should be removed as was done in #721:

https://github.com/modin-project/modin/pull/721/files#diff-f030cc083716a25f1211475c41633d4bL24-L103

Resolving patch:
diff --git a/modin/engines/python/pandas_on_python/frame/partition_manager.py b/modin/engines/python/pandas_on_python/frame/partition_manager.py
--- a/modin/engines/python/pandas_on_python/frame/partition_manager.py
+++ b/modin/engines/python/pandas_on_python/frame/partition_manager.py
@@ -26,50 +26,3 @@ class PythonFrameManager(BaseFrameManager):
     _partition_class = PandasOnPythonFramePartition
     _column_partitions_class = PandasOnPythonFrameColumnPartition
     _row_partition_class = PandasOnPythonFrameRowPartition
-
-    def __init__(self, partitions):
-        self.partitions = partitions
-
-    # We override these for performance reasons.
-    # Lengths of the blocks
-    _lengths_cache = None
-    # Widths of the blocks
-    _widths_cache = None
-
-    # These are set up as properties so that we only use them when we need
-    # them. We also do not want to trigger this computation on object creation.
-    @property
-    def block_lengths(self):
-        """Gets the lengths of the blocks.
-
-        Note: This works with the property structure `_lengths_cache` to avoid
-            having to recompute these values each time they are needed.
-        """
-        if self._lengths_cache is None:
-            # The first column will have the correct lengths. We have an
-            # invariant that requires that all blocks be the same length in a
-            # row of blocks.
-            self._lengths_cache = (
-                [obj.length() for obj in self._partitions_cache.T[0]]
-                if len(self._partitions_cache.T) > 0
-                else []
-            )
-        return self._lengths_cache
-
-    @property
-    def block_widths(self):
-        """Gets the widths of the blocks.
-
-        Note: This works with the property structure `_widths_cache` to avoid
-            having to recompute these values each time they are needed.
-        """
-        if self._widths_cache is None:
-            # The first column will have the correct lengths. We have an
-            # invariant that requires that all blocks be the same width in a
-            # column of blocks.
-            self._widths_cache = (
-                [obj.width() for obj in self._partitions_cache[0]]
-                if len(self._partitions_cache) > 0
-                else []
-            )
-        return self._widths_cache


Test patch: