pyvpacker


Namepyvpacker JSON
Version 1.1 PyPI version JSON
download
home_pagehttps://github.com/pglen/pyvpacker
SummaryPack python data onto a string.
upload_time2024-02-15 19:46:14
maintainer
docs_urlNone
authorPeter Glen
requires_python>=3
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# pypacker

##    Encode / Decode arbitrary data into a string.

    Op Codes (type codes):

    Int Number            i
    Float Number          f
    Character             c
    String                s
    Binary                b

    List                  a         (array) gets encoded as extended
    Tuple                 t         gets encoded as extended (x)
    Dict                  d         gets encoded as extended (x)

    Extended              x         encoded as new packer string (recursive)

    Usage:

        arr_of_data = [datax, [ datay], { dataz : valz } ... etc]
        formatstr = ""
        pb  = packbin()
        newdata  = pb.encode_data(formatstr, arr_of_data)
        decdata  = pb.decode_data(newdata)
        ?assert?(decdata == arr_of_data)

    Empty format string will use the auto-detected types: (recommended)

        newdata  = pb.encode_data("", arr_of_data)

        Preserves type and data. It is (mostly) 7/8 bit clean on
    both python2 and python 3.

    Note: python2 'bytes' type is a place holder - avoid encoding bytes on python 2
    and decoding bytes on python 3; or at least be aware of the issues. This does
    not effect the decoded data, but it does effect the cypher text.

      The following comes into play when one encodes data with python 2 and
    decodes it in python 3.

          Python V2 and V3 str / bytes differences. In python 2 the 'bytes' type is
        an alias to the str type. It accommodates the whole palette of numbers in
        py2; thus we detect binary by looking at the str and seeing if non printable
        characters are present.  (the character < ' ' or > 'del')
        This works well, however we consider it a work-around; so please be aware.

       If you assure both encoder and decoder are the same python version, this
    issue does not exist.

   History:

    Sat 18.Feb.2023 decode binary after done decomposing it
    Mon 18.Dec.2023 moved to pypacker dir
    Tue 19.Dec.2023 test for python2 python 3 -- note: bytes / v2 v3 differences
    Thu 21.Dec.2023 cleanmup, docs, etc ...

Pytest results:

    ============================= test session starts ==============================
    platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.0.0
    rootdir: /home/peterglen/pgpygtk/pypacker/tests
    collected 20 items

    test_arr.py ..                                                           [ 10%]
    test_bin.py ..                                                           [ 20%]
    test_complex.py ..                                                       [ 30%]
    test_dict.py .                                                           [ 35%]
    test_float.py ..                                                         [ 45%]
    test_int.py ..                                                           [ 55%]
    test_packer.py ......                                                    [ 85%]
    test_str.py ...                                                          [100%]

    ============================== 20 passed in 0.09s ==============================
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.11.0, pluggy-0.13.1
    rootdir: /home/peterglen/pgpygtk/pypacker/tests
    collected 20 items

    test_arr.py ..                                                           [ 10%]
    test_bin.py ..                                                           [ 20%]
    test_complex.py ..                                                       [ 30%]
    test_dict.py .                                                           [ 35%]
    test_float.py ..                                                         [ 45%]
    test_int.py ..                                                           [ 55%]
    test_packer.py ......                                                    [ 85%]
    test_str.py ...                                                          [100%]

    ========================== 20 passed in 0.12 seconds ===========================


   # EOF

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pglen/pyvpacker",
    "name": "pyvpacker",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "",
    "author": "Peter Glen",
    "author_email": "peterglen99@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/62/94/c15144b17b562ae3bee2c2b78c18f35bc6cb25c8e5e18b076cf7fa10a727/pyvpacker-1.1.tar.gz",
    "platform": null,
    "description": "\n# pypacker\n\n##    Encode / Decode arbitrary data into a string.\n\n    Op Codes (type codes):\n\n    Int Number            i\n    Float Number          f\n    Character             c\n    String                s\n    Binary                b\n\n    List                  a         (array) gets encoded as extended\n    Tuple                 t         gets encoded as extended (x)\n    Dict                  d         gets encoded as extended (x)\n\n    Extended              x         encoded as new packer string (recursive)\n\n    Usage:\n\n        arr_of_data = [datax, [ datay], { dataz : valz } ... etc]\n        formatstr = \"\"\n        pb  = packbin()\n        newdata  = pb.encode_data(formatstr, arr_of_data)\n        decdata  = pb.decode_data(newdata)\n        ?assert?(decdata == arr_of_data)\n\n    Empty format string will use the auto-detected types: (recommended)\n\n        newdata  = pb.encode_data(\"\", arr_of_data)\n\n        Preserves type and data. It is (mostly) 7/8 bit clean on\n    both python2 and python 3.\n\n    Note: python2 'bytes' type is a place holder - avoid encoding bytes on python 2\n    and decoding bytes on python 3; or at least be aware of the issues. This does\n    not effect the decoded data, but it does effect the cypher text.\n\n      The following comes into play when one encodes data with python 2 and\n    decodes it in python 3.\n\n          Python V2 and V3 str / bytes differences. In python 2 the 'bytes' type is\n        an alias to the str type. It accommodates the whole palette of numbers in\n        py2; thus we detect binary by looking at the str and seeing if non printable\n        characters are present.  (the character < ' ' or > 'del')\n        This works well, however we consider it a work-around; so please be aware.\n\n       If you assure both encoder and decoder are the same python version, this\n    issue does not exist.\n\n   History:\n\n    Sat 18.Feb.2023 decode binary after done decomposing it\n    Mon 18.Dec.2023 moved to pypacker dir\n    Tue 19.Dec.2023 test for python2 python 3 -- note: bytes / v2 v3 differences\n    Thu 21.Dec.2023 cleanmup, docs, etc ...\n\nPytest results:\n\n    ============================= test session starts ==============================\n    platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.0.0\n    rootdir: /home/peterglen/pgpygtk/pypacker/tests\n    collected 20 items\n\n    test_arr.py ..                                                           [ 10%]\n    test_bin.py ..                                                           [ 20%]\n    test_complex.py ..                                                       [ 30%]\n    test_dict.py .                                                           [ 35%]\n    test_float.py ..                                                         [ 45%]\n    test_int.py ..                                                           [ 55%]\n    test_packer.py ......                                                    [ 85%]\n    test_str.py ...                                                          [100%]\n\n    ============================== 20 passed in 0.09s ==============================\n    ============================= test session starts ==============================\n    platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.11.0, pluggy-0.13.1\n    rootdir: /home/peterglen/pgpygtk/pypacker/tests\n    collected 20 items\n\n    test_arr.py ..                                                           [ 10%]\n    test_bin.py ..                                                           [ 20%]\n    test_complex.py ..                                                       [ 30%]\n    test_dict.py .                                                           [ 35%]\n    test_float.py ..                                                         [ 45%]\n    test_int.py ..                                                           [ 55%]\n    test_packer.py ......                                                    [ 85%]\n    test_str.py ...                                                          [100%]\n\n    ========================== 20 passed in 0.12 seconds ===========================\n\n\n   # EOF\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Pack python data onto a string.",
    "version": "1.1",
    "project_urls": {
        "Homepage": "https://github.com/pglen/pyvpacker"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a1be431fbf0992f81de75b842d24403fc627f8adfdf05181899398d5f68c13f2",
                "md5": "0445271fe20806073e11b44e189bac4a",
                "sha256": "2aad4946b6e5ff6fdfb93105eeacfca4d199bea794fe4f2b189d7b59175de115"
            },
            "downloads": -1,
            "filename": "pyvpacker-1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0445271fe20806073e11b44e189bac4a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 7765,
            "upload_time": "2024-02-15T19:46:12",
            "upload_time_iso_8601": "2024-02-15T19:46:12.858081Z",
            "url": "https://files.pythonhosted.org/packages/a1/be/431fbf0992f81de75b842d24403fc627f8adfdf05181899398d5f68c13f2/pyvpacker-1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6294c15144b17b562ae3bee2c2b78c18f35bc6cb25c8e5e18b076cf7fa10a727",
                "md5": "a4230f4c1e8de8073e58e90878237f9f",
                "sha256": "da368d699b55de109b1d8e6af76bfcdc3f93549493153b5a405ecd4e2bd423fd"
            },
            "downloads": -1,
            "filename": "pyvpacker-1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a4230f4c1e8de8073e58e90878237f9f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 8563,
            "upload_time": "2024-02-15T19:46:14",
            "upload_time_iso_8601": "2024-02-15T19:46:14.840731Z",
            "url": "https://files.pythonhosted.org/packages/62/94/c15144b17b562ae3bee2c2b78c18f35bc6cb25c8e5e18b076cf7fa10a727/pyvpacker-1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-15 19:46:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pglen",
    "github_project": "pyvpacker",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyvpacker"
}
        
Elapsed time: 0.19165s