• Kirill Smelkov's avatar
    promis/plugin/check_free_disk_space: np.float -> float · 5c1d2f76
    Kirill Smelkov authored
    Running tests with recent numpy (1.26.0) yields the following:
    
        slapos.toolbox$ python -m unittest discover -v   -s slapos/test/promise/plugin/ -t . -k test_display_prediction
        ...
        Enable to display disk space predictions: True
        module 'numpy' has no attribute 'float'.
        `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
        The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
            https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
        Traceback (most recent call last):
          File "/home/kirr/src/wendelin/slapos/slapos.core/slapos/grid/promise/generic.py", line 500, in run
            self.sense()
          File "/home/kirr/src/wendelin/slapos/slapos.toolbox/slapos/promise/plugin/check_free_disk_space.py", line 327, in sense
            disk_space_prediction_tuple = self.diskSpacePrediction(
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/home/kirr/src/wendelin/slapos/slapos.toolbox/slapos/promise/plugin/check_free_disk_space.py", line 182, in diskSpacePrediction
            df = df.astype({'free': np.float})
                                    ^^^^^^^^
          File "/home/kirr/src/wendelin/venv/py3.venv/lib/python3.11/site-packages/numpy/__init__.py", line 324, in __getattr__
            raise AttributeError(__former_attrs__[attr])
        AttributeError: module 'numpy' has no attribute 'float'.
        `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
        The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
            https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
        ERROR
    
    -> Replace np.float with float as the error says.
    
    /cc @Just1, @lu.xu, @jhuge, @tomo
    /reviewed-on !123
    5c1d2f76
check_free_disk_space.py 15.1 KB