Commit Graph

97 Commits

Author SHA1 Message Date
Shane Harvey
7ca04999e9
PYTHON-1603 Truncate large datetimes properly (#362) 2018-07-09 16:28:48 -07:00
Bernie Hackett
ba7c95a9df PYTHON-1462 - Import ABCs from collections.abc 2018-02-12 19:42:44 -08:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Bernie Hackett
2719464837 PYTHON-1352 - Move BSON type map docs from bson.son.SON to bson 2017-11-08 11:24:28 -08:00
Shane Harvey
e775295ab5 PYTHON-1367 Ignore uuid_representation when decoding BSON binary subtype 4. 2017-09-12 17:20:14 -07:00
Bernie Hackett
82db71e1e8 PYTHON-1068 - Support for BSON Decimal128 2016-08-29 15:07:07 -07:00
Luke Lovett
b6c74cf33d PYTHON-1106 - Implement BSON corpus test suite. 2016-08-24 11:01:45 -07:00
Luke Lovett
6692e8877a PYTHON-1131 - Fix inconsistent handling of scope, unicode support for Code. 2016-08-19 15:22:19 -07:00
Shane Harvey
57d1ccde2f PYTHON-1111 Add JSONOptions for dumps and loads
PYTHON-767 Support JSON strict mode $date output
PYTHON-1039 Support JSON strict mode $numberLong output
PYTHON-1103 Support JSON strict mode UUID output
PYTHON-1111 Support custom document class in loads
PYTHON-1111 Support tz_aware and tzinfo in loads
Refactor milliseconds to datetime conversions
2016-07-27 11:32:59 -07:00
Bernie Hackett
6a14d70120 PYTHON-1044 - Fix up unknown BSON type handing 2016-01-28 11:21:34 -08:00
Luke Lovett
e4d3392f90 PYTHON-472 - Add a RawBSONDocument class that decodes its comprising bytes only on-demand.
This provides an API for inserting and returning raw BSON.
2015-11-18 15:00:09 -08:00
Luke Lovett
880394fe99 PYTHON-222 - Add a 'tzinfo' attribute to CodecOptions that specifies a timezone to which to decode datetime objects. 2015-07-09 13:32:23 -07:00
aherlihy
39308c4b2f PYTHON-721 - Add unicode_decode_error_handler to CodecOptions. 2015-07-09 15:08:02 -04:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
Bernie Hackett
c87424e7af PYTHON-856 - as_class -> document_class
This commit changes the name of the as_class option
in CodecOptions to document_class, to match the name
of the MongoClient option.
2015-03-09 14:32:42 -07:00
A. Jesse Jiryu Davis
9da835ab3d PYTHON-825 BSON API changes and internal options handling.
This change resolves four issues:

PYTHON-826 The new codec_options submodule is moved from pymongo to bson.

PYTHON-827 Use codec_options in BSON APIs.

Functions and methods of the bson module that accepted the options as_class,
tz_aware, and uuid_subtype now accept a codec_options parameter instead.

For example, the function definition for bson.decode_all changes from this:

def decode_all(data, as_class=dict, tz_aware=True,
               uuid_subtype=OLD_UUID_SUBTYPE)

to:

def decode_all(data, codec_options=CodecOptions())

The following functions are changed:

- decode_all
- decode_iter
- decode_file_iter

The following methods are changed:

- BSON.encode
- BSON.decode

This is a breaking change for any application that uses the BSON API directly
and changes any of the named parameter defaults. No changes are required for
applications that use the default values for these options. The behavior
remains the same.

PYTHON-828 Internal BSON module changes to support CodecOptions

The pure Python BSON module passes around a CodecOptions instance instead of
as_class, tz_aware, and uuid_subtype. C extensions pass these values around in
a struct.

PYTHON-801 Rename uuid_subtype to uuid_representation.
2015-02-05 23:09:23 -06:00
A. Jesse Jiryu Davis
2ba730722b PYTHON-526 Remove 'compile_re' option.
PyMongo now never attempts to compile BSON regular expressions as Python native
regular expressions.
2014-12-05 14:06:38 -05:00
Bernie Hackett
db4ab8d769 Use _UNPACK_INT in new BSON helpers. 2014-11-24 13:30:34 -08:00
Bernie Hackett
4e20ab3ca5 Document uuid_subtype parameter for BSON.encode/decode. 2014-11-24 13:14:39 -08:00
Bernie Hackett
c28975c395 Document to uuid_subtype parameter for decoders. 2014-11-24 13:14:39 -08:00
Bernie Hackett
6fd3d3926e Fix up docs for decode_(file_)iter. 2014-11-24 13:14:39 -08:00
Bernie Hackett
c6b9892c30 Allow decode_(file_)iter to use C extensions. 2014-11-24 13:14:39 -08:00
Bernie Hackett
6c82488b77 Add compile_re support to decode_(file_)iter. 2014-11-24 13:14:39 -08:00
Heewa Barfchin
b948b08854 Add generator versions of decode_all in bson.
When decoding large collections of bson documents, the python representation
of dicts are time and space costly, so it's sometimes useful to generate and
consume the documents iteratively. This patch adds two new functions to do
that: decode_iter and decode_file_iter. The first is given all the bson data,
but yields one document at a time, while the second reads from a file object
enough to yield one document at a time (to avoid reading in an entire file).
2014-11-24 13:14:39 -08:00
A. Jesse Jiryu Davis
08dccbba46 Remove ancient version annotations.
Delete "versionchanged" and "versionadded" directives that predate 2.0.
2014-10-31 14:15:24 -04:00
Bernie Hackett
9c8852d93f PYTHON-760 - BSONInt64 -> Int64 2014-09-23 11:43:41 -07:00
Bernie Hackett
5c4b2499eb PYTHON-346 - Use codecs for all string decoding/encoding. 2014-09-03 15:05:14 -07:00
Bernie Hackett
c6a1a2c384 PYTHON-346 - Type lookup and caching improvements. 2014-09-03 13:53:22 -07:00
Bernie Hackett
d3e74639f6 PYTHON-346 - Add _encode_mapping, cache subtypes. 2014-08-29 15:23:22 -07:00
Bernie Hackett
6e2f8a2773 PYTHON-346 - Remove buffer copies. 2014-08-28 10:55:45 -07:00
Bernie Hackett
f76618d45f Clean up an unnecessary constant definition. 2014-08-22 16:00:31 -07:00
Bernie Hackett
852b2d36f8 PYTHON-346 - Eliminate second _bson_to_dict return value
This has been unnecessary for many releases.
2014-08-22 15:35:56 -07:00
Bernie Hackett
e6809e8132 PYTHON-346 - Eliminate unnecessary datetime.replace call 2014-08-22 14:45:04 -07:00
Bernie Hackett
3e059f76d7 PYTHON-346 - Optimize decoding of most types.
This change provides perf improvements for decoding
most types in pure python. Like the previous changes
for encoding, the biggest improvements are seen decoding
BSON arrays to python lists - over 150% using pypy.
2014-08-22 11:40:49 -07:00
Bernie Hackett
adb37e2802 PYTHON-346 - Relocate _make_c_string and friends. 2014-08-21 15:34:20 -07:00
Bernie Hackett
09722a9b6b PYTHON-346 - Cleanup style and silence a host of pylint complaints. 2014-08-20 13:21:02 -07:00
Bernie Hackett
74f55a283a PYTHON-346 - Eliminate _get_int unsigned option
This cleans up a few pylint complaints and provides a
small perf improvement.
2014-08-20 11:30:12 -07:00
Bernie Hackett
8dc79d1b30 PYTHON-346 - Use a tuple for decoder options.
This is just a cleanup of the existing decoder. I tried
using a namedtuple but that imposed up to a 17% perf hit
(a regular tuple imposed no measureable perf hit). We may
be able to avoid that problem with a new API that accepts
decoder options in a specific class instead of creating the
instance in the decoder itself.
2014-08-20 11:10:04 -07:00
Luke Lovett
17fb3a2a02 PYTHON-505 Allow C extensions to encode any mapping type, not just dicts. 2014-08-13 16:16:25 +00:00
Bernie Hackett
4aa3f9f855 PYTHON-346 - Fix DBRef encoding under jython2.7
Jython doesn't support struct.pack_into for bytearray.
2014-07-22 17:38:10 -07:00
Bernie Hackett
799b11f2aa PYTHON-346 - Fix unhashable types issue in python 3.4. 2014-07-22 16:45:21 -07:00
Bernie Hackett
88372990d9 PYTHON-346 - Reimplement pure python BSON encoder.
This is the first step in rewriting the pure python BSON
module. These changes provide measurable improvements for
all types including up to a 95% improvement in encoding
performance for lists/tuples.
2014-07-22 15:42:23 -07:00
Luke Lovett
5136bb723c PYTHON-707 Add a BSONInt64 type. 2014-07-18 14:59:21 +00:00
Bernie Hackett
0a55f923c4 PYTHON-686 - Finish updating docs related to python 3.
Mostly removing references to 2to3, which we no longer use.
2014-04-24 10:35:20 -07:00
Bernie Hackett
b26459cd6a Remove useless uuid module checks.
These were only needed for python 2.4 which does
not provide a uuid module.
2014-04-24 10:09:21 -07:00
Bernie Hackett
bd8d4a3b10 PYTHON-673 - Use bytes and remove binary_type
The binary_type alias was added to support python
2.4 and 2.5, which we no longer support.
2014-04-23 13:25:00 -07:00
Luke Lovett
d4a94d30fd PYTHON-673 python 2/3 single-source for the bson module 2014-04-17 21:29:15 +00:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
Kyle Erf
e100ddcb20 PYTHON-623: do not allow sending _ids with a key starting with $ 2014-01-14 12:51:37 -08:00
A. Jesse Jiryu Davis
d625ff2bc9 Rename Regex.compile() to try_compile() and add a warning, add from_native(), PYTHON-500. 2013-12-07 15:37:12 -05:00