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

Deprecate copytree method #439

Merged
merged 10 commits into from
Jan 21, 2021
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 changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Changed
- State points are loaded lazily when ``Job`` is opened by id (#238, #239).
- Optimized ``Job`` and ``Project`` classes to cache internal properties and initialize on access (#451).

Deprecated
++++++++++

- Deprecate ``syncutil.copytree`` method (#439).

[1.5.1] -- 2020-12-19
---------------------
Expand Down
4 changes: 4 additions & 0 deletions contributors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,8 @@ contributors:
given-names: Pengji
affiliation: "University of Michigan"
orcid: "https://orcid.org/0000-0002-1409-9633"
-
family-names: Dave
given-names: Shantanu
affiliation: "Jodhpur Institute of Engineering and Technology"
...
6 changes: 3 additions & 3 deletions signac/contrib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging
import os
import re
import shutil
import stat
import time
import uuid
Expand All @@ -22,7 +23,6 @@
from deprecation import deprecated
from packaging import version

from .. import syncutil
from ..common.config import Config, get_config, load_config
from ..core import json
from ..core.h5store import H5StoreManager
Expand Down Expand Up @@ -1494,7 +1494,7 @@ def update_statepoint(self, job, update, overwrite=False):
"""
job.update_statepoint(update=update, overwrite=overwrite)

def clone(self, job, copytree=syncutil.copytree):
def clone(self, job, copytree=shutil.copytree):
"""Clone job into this project.

Create an identical copy of job within this project.
Expand All @@ -1506,7 +1506,7 @@ def clone(self, job, copytree=syncutil.copytree):
job : :class:`~signac.contrib.job.Job`
The job to copy into this project.
copytree :
(Default value = syncutil.copytree)
(Default value = :func:`shutil.copytree`)

Returns
-------
Expand Down
10 changes: 10 additions & 0 deletions signac/syncutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
from copy import deepcopy
from filecmp import dircmp

from deprecation import deprecated

from .version import __version__

LEVEL_MORE = logging.INFO - 5

logger = logging.getLogger("sync")
Expand All @@ -26,6 +30,12 @@ def log_more(msg, *args, **kwargs):
logger.more = log_more # type: ignore


@deprecated(
deprecated_in="1.6.0",
removed_in="2.0.0",
current_version=__version__,
details="Use shutil.copytree instead.",
)
def copytree(src, dst, copy_function=shutil.copy2, symlinks=False):
"""Recursively copy a directory tree from src to dst, using a custom copy function.

Expand Down