Skip to content

Commit

Permalink
Add execute command
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya-mohammadi committed Jan 28, 2025
1 parent 69b7903 commit c304902
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deep_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .utils.lib_utils.integeration_utils import import_lazy_module

# Deep Utils version number
__version__ = "1.3.62"
__version__ = "1.3.63"

from .utils.constants import DUMMY_PATH, Backends

Expand Down
12 changes: 10 additions & 2 deletions deep_utils/utils/dir_utils/dir_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def remove_create(dir_: str, remove=True, logger=None, verbose=1):
raise ValueError("dir_ should be provided!")



def file_incremental(file_path: str, artifact_type="prefix", artifact_value=0, extra_punctuation="_",
add_artifact_value=False):
"""
Expand Down Expand Up @@ -917,6 +916,7 @@ def file_incremental(file_path: str | None, artifact_type="prefix", artifact_val
file_path = join(dir_, file_path)
artifact_value += 1
return file_path

@staticmethod
def mkdir_incremental(dir_path: str | list[str], base_name="exp", fix_name=None, overwrite=False) -> Path:
"""
Expand Down Expand Up @@ -954,4 +954,12 @@ def mkdir_incremental(dir_path: str | list[str], base_name="exp", fix_name=None,

return Path(final_path)

mkdir_incremental = DirUtils.mkdir_incremental
@staticmethod
def execute_command(command: str):
from subprocess import Popen, PIPE
process = Popen(command, stdout=PIPE, stderr=None, shell=True)
output = process.communicate()[0]
return output.decode()


mkdir_incremental = DirUtils.mkdir_incremental
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import setuptools

VERSION = "1.3.62"
VERSION = "1.3.63"

long_description = open("Readme.md", mode="r", encoding="utf-8").read()

Expand Down

0 comments on commit c304902

Please sign in to comment.