You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

save-return

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

save-return

Save the return value of the decorated function to a versioned pickle file

0.2.0
pipPyPI
Maintainers
1

save-return

Save the return value of the decorated function to a versioned pickle file.

Save

import save_return

@save_return.save('value_of_pi')
def calc_pi():
    return 4

pi = calc_pi()

This will pickle.save pi to ./data/save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00000.pkl

If used inside a Jupyter notebook named x.ipynb, it will instead save to ./x.ipynb.save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00000.pkl

Use @save_return.save(..., save_dir="some-dir") to customize the save location.

pi = calc_pi()

Call it again will save pi to ./data/save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00001.pkl

Load

The load function is just a wrapper around pickle:

pi = save_return.load('./data/save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00000.pkl')

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts