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

Use FutureWarning instead of DeprecationWarning in project.py #691

Merged
merged 2 commits into from
Feb 28, 2022
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
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Changed
+++++++

- Schema migration is now performed on directories rather than signac projects and supports a wider range of schemas (#654).
- Deprecated features now use ``FutureWarning`` instead of ``DeprecationWarning``, which is hidden by default (#687, #691).

Deprecated
++++++++++
Expand Down
20 changes: 10 additions & 10 deletions signac/contrib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def find_job_ids(self, filter=None, doc_filter=None):
if doc_filter:
filter.update(doc_filter)
elif doc_filter:
warnings.warn(DOC_FILTER_WARNING, DeprecationWarning)
warnings.warn(DOC_FILTER_WARNING, FutureWarning)
filter = doc_filter
return self._collection._find(filter)

Expand Down Expand Up @@ -919,7 +919,7 @@ def detect_schema(self, exclude_const=False, subset=None, index=None):
if index is None:
index = self.index(include_job_document=False)
else:
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)
if subset is not None:
subset = {str(s) for s in subset}
index = [doc for doc in index if doc["_id"] in subset]
Expand Down Expand Up @@ -1031,15 +1031,15 @@ def _find_job_ids(self, filter=None, doc_filter=None, index=None):
if index is None:
filter = dict(parse_filter(_add_prefix("sp.", filter)))
if doc_filter:
warnings.warn(DOC_FILTER_WARNING, DeprecationWarning)
warnings.warn(DOC_FILTER_WARNING, FutureWarning)
filter.update(parse_filter(_add_prefix("doc.", doc_filter)))
index = self.index(include_job_document=True)
elif "doc" in _root_keys(filter):
index = self.index(include_job_document=True)
else:
index = self._sp_index()
else:
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)

return Collection(index, _trust=True)._find(filter)

Expand Down Expand Up @@ -1079,7 +1079,7 @@ def find_jobs(self, filter=None, doc_filter=None):
"""
filter = dict(parse_filter(_add_prefix("sp.", filter)))
if doc_filter:
warnings.warn(DOC_FILTER_WARNING, DeprecationWarning)
warnings.warn(DOC_FILTER_WARNING, FutureWarning)
filter.update(parse_filter(_add_prefix("doc.", doc_filter)))
return JobsCursor(self, filter)

Expand Down Expand Up @@ -1521,7 +1521,7 @@ def create_linked_view(self, prefix=None, job_ids=None, index=None, path=None):

"""
if index is not None:
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)
from .linked_view import create_linked_view

return create_linked_view(self, prefix, job_ids, index, path)
Expand Down Expand Up @@ -1922,7 +1922,7 @@ def repair(self, fn_statepoints=None, index=None, job_ids=None):
if index is not None:
for doc in index:
self._sp_cache[doc["signac_id"]] = doc["sp"]
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)
corrupted = []
for job_id in job_ids:
try:
Expand Down Expand Up @@ -2226,7 +2226,7 @@ def create_access_module(self, filename=None, main=True, master=None):
"""
if master is not None:
warnings.warn(
"The parameter master has been renamed to main.", DeprecationWarning
"The parameter master has been renamed to main.", FutureWarning
)
main = master

Expand Down Expand Up @@ -2326,7 +2326,7 @@ def init_project(cls, name=None, root=None, workspace=None, make_dir=True):
"Project names are deprecated and will be removed in signac 2.0 in favor of using "
"the project root directory to identify projects. The name argument to "
"init_project should be removed.",
DeprecationWarning,
FutureWarning,
)
else:
name = _DEFAULT_PROJECT_NAME
Expand Down Expand Up @@ -2647,7 +2647,7 @@ def next(self):
"""
warnings.warn(
"Calling next() directly on a JobsCursor is deprecated! Use next(iter(..)) instead.",
DeprecationWarning,
FutureWarning,
)
if self._next_iter is None:
self._next_iter = iter(self)
Expand Down