File: PKG-INFO

package info (click to toggle)
tnetstring 0.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 164 kB
  • sloc: ansic: 1,099; python: 446; makefile: 5
file content (63 lines) | stat: -rw-r--r-- 2,779 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Metadata-Version: 1.0
Name: tnetstring
Version: 0.2.1
Summary: data serialization using typed netstrings
Home-page: http://github.com/rfk/tnetstring
Author: Ryan Kelly
Author-email: ryan@rfk.id.au
License: MIT
Description: 
        tnetstring:  data serialization using typed netstrings
        ======================================================
        
        
        This is a data serialization library. It's a lot like JSON but it uses a
        new syntax called "typed netstrings" that Zed has proposed for use in the
        Mongrel2 webserver.  It's designed to be simpler and easier to implement
        than JSON, with a happy consequence of also being faster in many cases.
        
        An ordinary netstring is a blob of data prefixed with its length and postfixed
        with a sanity-checking comma.  The string "hello world" encodes like this::
        
            11:hello world,
        
        Typed netstrings add other datatypes by replacing the comma with a type tag.
        Here's the integer 12345 encoded as a tnetstring::
        
            5:12345#
        
        And here's the list [12345,True,0] which mixes integers and bools::
        
            19:5:12345#4:true!1:0#]
        
        Simple enough?  This module gives you the following functions:
        
            :dump:    dump an object as a tnetstring to a file
            :dumps:   dump an object as a tnetstring to a string
            :load:    load a tnetstring-encoded object from a file
            :loads:   load a tnetstring-encoded object from a string
            :pop:     pop a tnetstring-encoded object from the front of a string
        
        Note that since parsing a tnetstring requires reading all the data into memory
        at once, there's no efficiency gain from using the file-based versions of these
        functions.  They're only here so you can use load() to read precisely one
        item from a file or socket without consuming any extra data.
        
        The tnetstrings specification explicitly states that strings are binary blobs
        and forbids the use of unicode at the protocol level.  As a convenience to
        python programmers, this library lets you specify an application-level encoding
        to translate python's unicode strings to and from binary blobs:
        
            >>> print repr(tnetstring.loads("2:\xce\xb1,"))
            '\xce\xb1'
            >>> 
            >>> print repr(tnetstring.loads("2:\xce\xb1,", "utf8"))
            u'\u03b1'
        
        
Keywords: netstring serialize
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License