Skip to main content

File manager to deal with json and pickle files

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jpfmanager-0.0.3.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file jpfmanager-0.0.3.tar.gz.

File metadata

  • Download URL: jpfmanager-0.0.3.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for jpfmanager-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a5ea874fcb8ba73ac31dc7df046c84834738de794c10e6e946ab3952d3513674
MD5 11de7b852ce83d374108314ca4c4e456
BLAKE2b-256 3bc199d6dfcb4f943dd6a6c60bd94947905fbaa262beef17b8501b60a663628e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page