Skip to main content

You can use jpf manager to help in saving / getting objects to / from file using either json or pickle

Exemple:

file test_jpf.py:

from pathlib import Path
from jpfmanager.jpf import FileManager
from toti_class import toti


if __name__ == "__main__":
    x = toti(5,6)
    pathi = str((Path(__file__).parent / 'test1.tst').absolute())
    FileManager.save(x,pathi)
    newX = FileManager.get(pathi)
    print(newX)

File toti_class.py

class toti(object):
    def __init__(self, val1, val2):
        self.Val1 = val1
        self.Val2 = val2

FileManager.save(object, path, method = None)

Args:
       path: provide a string path to where the file will be saved
       object: provide the object you want to save in that file
       method: save using either json or pickle, json is set by default
   Returns:
       bool representing if the save operation succedded

FileManager.get(path, method = None):

    Args:
        path: provide a string path to where the file is saved           
        method: save using either json or pickle, json is set by default
    Returns:
        False if the path is not correct or it is not a file path
        the content txt file in case of using json method and object in case of using the pickle method

json pickle file manager repo

Release files for jpfmanager 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jpfmanager 0.0.3
File Size Uploaded
jpfmanager-0.0.3.tar.gz 2.9 kB Details

Release files / jpfmanager-0.0.3.tar.gz

Download URL jpfmanager-0.0.3.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a5ea874fcb8ba73ac31dc7df046c84834738de794c10e6e946ab3952d3513674
BLAKE2b-256 checksum
How to use checksums
3bc199d6dfcb4f943dd6a6c60bd94947905fbaa262beef17b8501b60a663628e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.1

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page