<commit_before>bson
====


Independent BSON codec for Python that doesn't depend on MongoDB.


Installation
------------

.. sourcecode:: bash

   ~ $ python setup.py install

or can use pip

.. sourcecode:: bash

   ~ $ pip install bson


Quick start
-----------

.. sourcecode:: python

   >>> import bson
   >>> a = bson.dumps({"A":[1,2,3,4,5,"6", u"7", {"C":u"DS"}]})
   >>> b = bson.loads(a)
   >>> b
   {'A': [1, 2, 3, 4, 5, '6', u'7', {'C': u'DS'}]}


Sending and receiving BSON objects to and from network sockets.


.. sourcecode:: python

   >>> from gevent import monkey, socket
   >>> monkey.patch_all()
   >>>
   >>> import bson
   >>> bson.patch_socket()
   >>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   >>> s.connect(("127.0.0.1", 12345))
   >>> s.sendobj({u"message" : "hello!"})
<commit_msg>Added badges<commit_after>bson
====


.. image:: https://badge.fury.io/py/bson.svg?
   :target: https://pypi.python.org/pypi/bson
.. image:: https://travis-ci.org/py-bson/bson.svg?branch=master
   :target: https://travis-ci.org/py-bson/bson
   

Independent BSON codec for Python that doesn't depend on MongoDB.


Installation
------------

.. sourcecode:: bash

   ~ $ python setup.py install

or can use pip

.. sourcecode:: bash

   ~ $ pip install bson


Quick start
-----------

.. sourcecode:: python

   >>> import bson
   >>> a = bson.dumps({"A":[1,2,3,4,5,"6", u"7", {"C":u"DS"}]})
   >>> b = bson.loads(a)
   >>> b
   {'A': [1, 2, 3, 4, 5, '6', u'7', {'C': u'DS'}]}


Sending and receiving BSON objects to and from network sockets.


.. sourcecode:: python

   >>> from gevent import monkey, socket
   >>> monkey.patch_all()
   >>>
   >>> import bson
   >>> bson.patch_socket()
   >>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   >>> s.connect(("127.0.0.1", 12345))
   >>> s.sendobj({u"message" : "hello!"})

{'fraction_non_alphanumeric': 0.22396114409066378, 'fraction_numerical': 0.026983270372369132, 'mean_word_length': 2.8544698544698544, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 75, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7500331', 'n_tokens_mistral': 747, 'n_tokens_neox': 690, 'n_words': 163}