From 2b5b4bd00801a1c05d3a5093d4dd556ff87941ad Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 13 Aug 2017 01:12:33 +0800 Subject: utils/io.py: Improve documentations --- fg21sim/utils/io.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'fg21sim/utils') diff --git a/fg21sim/utils/io.py b/fg21sim/utils/io.py index 4f05e96..2ce7cda 100644 --- a/fg21sim/utils/io.py +++ b/fg21sim/utils/io.py @@ -93,7 +93,7 @@ def pickle_dump(obj, outfile, clobber=False): NOTE ---- The dumped output file is in binary format, and can be loaded back - using ``pickle.load()``. + using ``pickle.load()``, e.g., the ``pickle_load()`` function below. Example ------- @@ -105,6 +105,11 @@ def pickle_dump(obj, outfile, clobber=False): Parameters ---------- + outfile : str + The path/filename to the output file storing the pickled object. + clobber : bool, optional + Whether to overwrite the existing output file. + Default: False """ _create_dir(outfile) _check_existence(outfile, clobber=clobber, remove=True) @@ -113,4 +118,17 @@ def pickle_dump(obj, outfile, clobber=False): def pickle_load(infile): + """ + Load the pickled Python back from the given file. + + Parameters + ---------- + infile : str + The path/filename to the data file, e.g., dumped by the above + ``pickle_dump()`` function. + + Returns + ------- + obj : The loaded Python object from the input file. + """ return pickle.load(open(infile, "rb")) -- cgit v1.2.2