FeatureEnVi: Visual Analytics for Feature Engineering Using Stepwise Selection and Semi-Automatic Extraction Approaches https://doi.org/10.1109/TVCG.2022.3141040
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
FeatureEnVi/backend/venv/lib/python3.7/site-packages/pymongo/read_concern.py

76 lines
2.3 KiB

# Copyright 2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License",
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tools for working with read concerns."""
from bson.py3compat import string_type
class ReadConcern(object):
"""ReadConcern
:Parameters:
- `level`: (string) The read concern level specifies the level of
isolation for read operations. For example, a read operation using a
read concern level of ``majority`` will only return data that has been
written to a majority of nodes. If the level is left unspecified, the
server default will be used.
.. versionadded:: 3.2
"""
def __init__(self, level=None):
if level is None or isinstance(level, string_type):
self.__level = level
else:
raise TypeError(
'level must be a string or None.')
@property
def level(self):
"""The read concern level."""
return self.__level
@property
def ok_for_legacy(self):
"""Return ``True`` if this read concern is compatible with
old wire protocol versions."""
return self.level is None or self.level == 'local'
@property
def document(self):
"""The document representation of this read concern.
.. note::
:class:`ReadConcern` is immutable. Mutating the value of
:attr:`document` does not mutate this :class:`ReadConcern`.
"""
doc = {}
if self.__level:
doc['level'] = self.level
return doc
def __eq__(self, other):
if isinstance(other, ReadConcern):
return self.document == other.document
return NotImplemented
def __repr__(self):
if self.level:
return 'ReadConcern(%s)' % self.level
return 'ReadConcern()'
DEFAULT_READ_CONCERN = ReadConcern()