Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/synced collection/deprecate old #483

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions signac/core/attrdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

from .synceddict import _SyncedDict

"""
THIS MODULE IS DEPRECATED!
"""


class SyncedAttrDict(_SyncedDict):
"""A synced dictionary where (nested) values can be accessed as attributes.
Expand Down
37 changes: 37 additions & 0 deletions signac/core/jsondict.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from copy import copy
from tempfile import mkstemp

from deprecation import deprecated

from ..version import __version__
from . import json
from .attrdict import SyncedAttrDict
from .errors import Error
Expand All @@ -29,6 +32,10 @@
_JSONDICT_HASHES = {}
_JSONDICT_META = {}

"""
THIS MODULE IS DEPRECATED!
"""


class BufferException(Error):
"""An exception occurred in buffered mode."""
Expand Down Expand Up @@ -91,6 +98,11 @@ def _store_in_buffer(filename, blob, store_hash=False):
return True


@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
def flush_all():
"""Execute all deferred JSONDict write operations."""
global _BUFFER_LOAD
Expand Down Expand Up @@ -127,21 +139,41 @@ def flush_all():
_BUFFER_LOAD = 0


@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
def get_buffer_size():
"""Return the current maximum size of the read/write buffer."""
return _BUFFER_SIZE


@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
def get_buffer_load():
"""Return the current actual size of the read/write buffer."""
return _BUFFER_LOAD


@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
def in_buffered_mode():
"""Return true if in buffered read/write mode."""
return _BUFFERED_MODE > 0


@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
@contextmanager
def buffer_reads_writes(buffer_size=DEFAULT_BUFFER_SIZE, force_write=False):
"""Enter a global buffer mode for all JSONDict instances.
Expand Down Expand Up @@ -253,6 +285,11 @@ class JSONDict(SyncedAttrDict):
A parent instance of JSONDict or None.
"""

@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
def __init__(self, filename=None, write_concern=False, parent=None):
if (filename is None) == (parent is None):
raise ValueError(
Expand Down
18 changes: 18 additions & 0 deletions signac/core/synceddict.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
from copy import deepcopy
from functools import wraps

from deprecation import deprecated

from ..version import __version__

try:
import numpy

Expand All @@ -18,8 +22,17 @@

logger = logging.getLogger(__name__)

"""
THIS MODULE IS DEPRECATED!
"""


class _SyncedList(list):
@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
def __init__(self, iterable, parent):
self._parent = parent
super().__init__(iterable)
Expand Down Expand Up @@ -79,6 +92,11 @@ class _SyncedDict(MutableMapping):

VALID_KEY_TYPES = (str, int, bool, type(None))

@deprecated(
deprecated_in="1.7",
removed_in="2.0",
current_version=__version__,
)
def __init__(self, initialdata=None, parent=None):
self._suspend_sync_ = 1
self._parent = parent
Expand Down