~ubuntu-branches/ubuntu/wily/pymongo/wily-proposed

« back to all changes in this revision

Viewing changes to pymongo/__init__.py

  • Committer: Package Import Robot
  • Author(s): Federico Ceratto
  • Date: 2015-04-26 22:43:13 UTC
  • mfrom: (24.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20150426224313-0hga2jphvf0rrmfe
Tags: 3.0.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2014 MongoDB, Inc.
 
1
# Copyright 2009-2015 MongoDB, Inc.
2
2
#
3
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
4
# you may not use this file except in compliance with the License.
14
14
 
15
15
"""Python driver for MongoDB."""
16
16
 
17
 
 
18
17
ASCENDING = 1
19
18
"""Ascending sort order."""
20
19
DESCENDING = -1
23
22
GEO2D = "2d"
24
23
"""Index specifier for a 2-dimensional `geospatial index`_.
25
24
 
26
 
.. versionadded:: 1.5.1
27
 
 
28
 
.. note:: Geo-spatial indexing requires server version **>= 1.3.3**.
29
 
 
30
25
.. _geospatial index: http://docs.mongodb.org/manual/core/2d/
31
26
"""
32
27
 
35
30
 
36
31
.. versionadded:: 2.1
37
32
 
38
 
.. note:: Geo-spatial indexing requires server version **>= 1.5.6**.
39
 
 
40
33
.. _haystack index: http://docs.mongodb.org/manual/core/geohaystack/
41
34
"""
42
35
 
77
70
ALL = 2
78
71
"""Profile all operations."""
79
72
 
80
 
version_tuple = (2, 7, 2)
 
73
version_tuple = (3, 0, 1)
81
74
 
82
75
def get_version_string():
83
 
    if isinstance(version_tuple[-1], basestring):
 
76
    if isinstance(version_tuple[-1], str):
84
77
        return '.'.join(map(str, version_tuple[:-1])) + version_tuple[-1]
85
78
    return '.'.join(map(str, version_tuple))
86
79
 
87
80
version = get_version_string()
88
81
"""Current version of PyMongo."""
89
82
 
 
83
from pymongo.collection import ReturnDocument
90
84
from pymongo.common import (MIN_SUPPORTED_WIRE_VERSION,
91
85
                            MAX_SUPPORTED_WIRE_VERSION)
92
 
from pymongo.connection import Connection
 
86
from pymongo.cursor import CursorType
93
87
from pymongo.mongo_client import MongoClient
94
88
from pymongo.mongo_replica_set_client import MongoReplicaSetClient
95
 
from pymongo.replica_set_connection import ReplicaSetConnection
 
89
from pymongo.operations import (IndexModel,
 
90
                                InsertOne,
 
91
                                DeleteOne,
 
92
                                DeleteMany,
 
93
                                UpdateOne,
 
94
                                UpdateMany,
 
95
                                ReplaceOne)
96
96
from pymongo.read_preferences import ReadPreference
 
97
from pymongo.write_concern import WriteConcern
97
98
 
98
99
def has_c():
99
 
    """Is the C extension installed?
100
 
 
101
 
    .. versionadded:: 1.5
102
 
    """
 
100
    """Is the C extension installed?"""
103
101
    try:
104
102
        from pymongo import _cmessage
105
103
        return True