varpickler


Namevarpickler JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/varpickler
Summarypickle / unpickle variables
upload_time2023-05-24 01:45:15
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords pickle unpickle
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pickle / unpickle variables


### Tested against Windows 10 / Python 3.10 / Anaconda

### pip install varpickler


```python
decode_var(obj: Any, pickle_or_dill: str = 'dill', base: str = 'base64', str_decode: str | None = None) -> Any
    Decode a Python object that was encoded using either the 'pickle' or 'dill' library,
    and then decode the baseXX encoded result.
    
    Parameters:
        obj (str or bytes): The encoded object to be decoded.
        pickle_or_dill (str, optional): The library to be used for decoding.
            Valid options are 'pickle' or 'dill'. Defaults to 'dill'.
        base (str, optional): The base encoding used in the encoded object.
            Defaults to 'base64'.
        str_decode (str, optional): The string encoding used after baseXX encoding.
            If None, no additional string decoding is performed. Defaults to None.
    
    Returns:
        object: The decoded object.
    
    Example:
        import numpy as np
        obj = np.array([23, 34, 4])
        a1 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode=None)
        a2 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode="utf-8")
        a3 = decode_var(a1, pickle_or_dill="dill", base="base64", str_decode=None)
        print(a3)
        a4 = decode_var(a2, pickle_or_dill="dill", base="base64", str_decode="utf-8")
        print(a4)
    
        [23 34  4]
        [23 34  4]



```

```python
encode_var(obj: Any, pickle_or_dill: str = 'dill', base: str = 'base64', str_encode: str | None = None) -> str | bytes
        Encode a Python object using either the 'pickle' or 'dill' library, and then encode the result using baseXX encoding.
    
        Parameters:
            obj (object): The object to be encoded.
            pickle_or_dill (str, optional): The library to be used for encoding.
                Valid options are 'pickle' or 'dill'. Defaults to 'dill'.
            base (str, optional): The base encoding to be used.
                Defaults to 'base64'.
            str_encode (str, optional): The string encoding to be used after baseXX encoding.
                If None, no additional string encoding is performed. Defaults to None.
    
        Returns:
            str or bytes: The encoded object. If 'str_encode' is None, a bytes object is returned.
                Otherwise, a string object is returned.
    
        Example:
            obj = np.array([23, 34, 4])
            >>> a1 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode=None)
            >>> print(a1)
            b'gAWVtgAAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKIwVbnVtcHkuY29yZS5t
    dWx0aWFycmF5lIwMX3JlY29uc3RydWN0lJOUjAVudW1weZSMB25kYXJyYXmUk5RLAIWUQwFilIeU
    KEsBSwOFlGgGjAVkdHlwZZSTlIwCaTSUiYiHlFKUKEsDjAE8lE5OTkr/////Sv////9LAHSUYolD
    DBcAAAAiAAAABAAAAJR0lE50lFKULg==
    '
    
            >>> a2 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode="utf-8")
            >>> print(a2)
            'gAWVtgAAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKIwVbnVtcHkuY29yZS5t
            dWx0aWFycmF5lIwMX3JlY29uc3RydWN0lJOUjAVudW1weZSMB25kYXJyYXmUk5RLAIWUQwFilIeU
            KEsBSwOFlGgGjAVkdHlwZZSTlIwCaTSUiYiHlFKUKEsDjAE8lE5OTkr/////Sv////9LAHSUYolD
            DBcAAAAiAAAABAAAAJR0lE50lFKULg=='

	
```






            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/varpickler",
    "name": "varpickler",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pickle,unpickle",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7c/03/f7acc4cdd406f27275a37700eae2d5bccd6630e2cde7de158f045482cf66/varpickler-0.10.tar.gz",
    "platform": null,
    "description": "# pickle / unpickle variables\r\n\r\n\r\n### Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n### pip install varpickler\r\n\r\n\r\n```python\r\ndecode_var(obj: Any, pickle_or_dill: str = 'dill', base: str = 'base64', str_decode: str | None = None) -> Any\r\n    Decode a Python object that was encoded using either the 'pickle' or 'dill' library,\r\n    and then decode the baseXX encoded result.\r\n    \r\n    Parameters:\r\n        obj (str or bytes): The encoded object to be decoded.\r\n        pickle_or_dill (str, optional): The library to be used for decoding.\r\n            Valid options are 'pickle' or 'dill'. Defaults to 'dill'.\r\n        base (str, optional): The base encoding used in the encoded object.\r\n            Defaults to 'base64'.\r\n        str_decode (str, optional): The string encoding used after baseXX encoding.\r\n            If None, no additional string decoding is performed. Defaults to None.\r\n    \r\n    Returns:\r\n        object: The decoded object.\r\n    \r\n    Example:\r\n        import numpy as np\r\n        obj = np.array([23, 34, 4])\r\n        a1 = encode_var(obj, pickle_or_dill=\"dill\", base=\"base64\", str_encode=None)\r\n        a2 = encode_var(obj, pickle_or_dill=\"dill\", base=\"base64\", str_encode=\"utf-8\")\r\n        a3 = decode_var(a1, pickle_or_dill=\"dill\", base=\"base64\", str_decode=None)\r\n        print(a3)\r\n        a4 = decode_var(a2, pickle_or_dill=\"dill\", base=\"base64\", str_decode=\"utf-8\")\r\n        print(a4)\r\n    \r\n        [23 34  4]\r\n        [23 34  4]\r\n\r\n\r\n\r\n```\r\n\r\n```python\r\nencode_var(obj: Any, pickle_or_dill: str = 'dill', base: str = 'base64', str_encode: str | None = None) -> str | bytes\r\n        Encode a Python object using either the 'pickle' or 'dill' library, and then encode the result using baseXX encoding.\r\n    \r\n        Parameters:\r\n            obj (object): The object to be encoded.\r\n            pickle_or_dill (str, optional): The library to be used for encoding.\r\n                Valid options are 'pickle' or 'dill'. Defaults to 'dill'.\r\n            base (str, optional): The base encoding to be used.\r\n                Defaults to 'base64'.\r\n            str_encode (str, optional): The string encoding to be used after baseXX encoding.\r\n                If None, no additional string encoding is performed. Defaults to None.\r\n    \r\n        Returns:\r\n            str or bytes: The encoded object. If 'str_encode' is None, a bytes object is returned.\r\n                Otherwise, a string object is returned.\r\n    \r\n        Example:\r\n            obj = np.array([23, 34, 4])\r\n            >>> a1 = encode_var(obj, pickle_or_dill=\"dill\", base=\"base64\", str_encode=None)\r\n            >>> print(a1)\r\n            b'gAWVtgAAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKIwVbnVtcHkuY29yZS5t\r\n    dWx0aWFycmF5lIwMX3JlY29uc3RydWN0lJOUjAVudW1weZSMB25kYXJyYXmUk5RLAIWUQwFilIeU\r\n    KEsBSwOFlGgGjAVkdHlwZZSTlIwCaTSUiYiHlFKUKEsDjAE8lE5OTkr/////Sv////9LAHSUYolD\r\n    DBcAAAAiAAAABAAAAJR0lE50lFKULg==\r\n    '\r\n    \r\n            >>> a2 = encode_var(obj, pickle_or_dill=\"dill\", base=\"base64\", str_encode=\"utf-8\")\r\n            >>> print(a2)\r\n            'gAWVtgAAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKIwVbnVtcHkuY29yZS5t\r\n            dWx0aWFycmF5lIwMX3JlY29uc3RydWN0lJOUjAVudW1weZSMB25kYXJyYXmUk5RLAIWUQwFilIeU\r\n            KEsBSwOFlGgGjAVkdHlwZZSTlIwCaTSUiYiHlFKUKEsDjAE8lE5OTkr/////Sv////9LAHSUYolD\r\n            DBcAAAAiAAAABAAAAJR0lE50lFKULg=='\r\n\r\n\t\r\n```\r\n\r\n\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "pickle / unpickle variables",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/varpickler"
    },
    "split_keywords": [
        "pickle",
        "unpickle"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6058f4211776b1bf47c90ea8c10f838fee5dbd2eb85130bf2adcf526a790d777",
                "md5": "73f1c28641a5b85a9ad8c89f82a197aa",
                "sha256": "a886bc308179cc1247f9c66e86bcc135fde539b57d302ea56f63e1326e736506"
            },
            "downloads": -1,
            "filename": "varpickler-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "73f1c28641a5b85a9ad8c89f82a197aa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6776,
            "upload_time": "2023-05-24T01:45:12",
            "upload_time_iso_8601": "2023-05-24T01:45:12.968089Z",
            "url": "https://files.pythonhosted.org/packages/60/58/f4211776b1bf47c90ea8c10f838fee5dbd2eb85130bf2adcf526a790d777/varpickler-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c03f7acc4cdd406f27275a37700eae2d5bccd6630e2cde7de158f045482cf66",
                "md5": "fad3d3571985813edc5ab95e11d944dc",
                "sha256": "a47d0aa1cdeecbee5f4241e46117e20317bd9852536acdc6c4f2c8546ffaa51c"
            },
            "downloads": -1,
            "filename": "varpickler-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "fad3d3571985813edc5ab95e11d944dc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5015,
            "upload_time": "2023-05-24T01:45:15",
            "upload_time_iso_8601": "2023-05-24T01:45:15.707461Z",
            "url": "https://files.pythonhosted.org/packages/7c/03/f7acc4cdd406f27275a37700eae2d5bccd6630e2cde7de158f045482cf66/varpickler-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-24 01:45:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "varpickler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "varpickler"
}
        
Elapsed time: 0.37460s