Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • PyPI
  • Socket score

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc