py416
Advanced tools
| [console_scripts] | ||
| rmd = py416.scripts:rmd | ||
| uzd = py416.scripts:uzd |
| ''' | ||
| | Author: Ezio416 | ||
| | Created: 2023-03-14 | ||
| | Updated: 2023-03-14 | ||
| - Functions behind console scripts | ||
| - Call these functions directly by name from the command line | ||
| ''' | ||
| import sys | ||
| from .files import rmdir, unzipdir | ||
| def rmd(): | ||
| ''' | ||
| - recursively deletes empty directories | ||
| - wraps `os.rmdir() <https://docs.python.org/3/library/os.html#os.rmdir>`_ | ||
| Arguments | ||
| --------- | ||
| - none: delete empty folders where we are, but leave our parent intact | ||
| - one argument: path to folder | ||
| - folder in which to delete empty folders | ||
| - two arguments: path to folder, anything | ||
| - if a second value is present, we'll also try to delete the given folder | ||
| - the second value itself is ignored | ||
| ''' | ||
| if len(sys.argv) > 1: | ||
| if len(sys.argv) > 2: | ||
| print(f'deleted {rmdir(sys.argv[1])} empty folders') | ||
| return | ||
| print(f'deleted {rmdir(sys.argv[1], delroot=False)} empty folders') | ||
| return | ||
| print(f'deleted {rmdir(".", delroot=False)} empty folders') | ||
| def uzd(): | ||
| ''' | ||
| - unzips all archive files in a folder until it is unable to continue | ||
| - recursive on archive files, but not folders | ||
| - deletes all archive files as it unzips | ||
| - supports archive files of type: (.7z, .gz, .rar, .tar, .zip) | ||
| Arguments | ||
| --------- | ||
| - if any argument is passed, the script will stop upon error | ||
| ''' | ||
| if len(sys.argv) > 1: | ||
| print(f'unzipped {unzipdir(ignore_errors=False)} archive file(s)') | ||
| return | ||
| print(f'unzipped {unzipdir()} archive file(s)') |
+1
-1
| Metadata-Version: 2.1 | ||
| Name: py416 | ||
| Version: 0.59 | ||
| Version: 0.60 | ||
| Summary: don't question my methods | ||
@@ -5,0 +5,0 @@ Author-email: Ezio416 <ezezio416@gmail.com> |
+5
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "py416" | ||
| version = "0.59" | ||
| version = "0.60" | ||
| authors = [ | ||
@@ -30,1 +30,5 @@ { name="Ezio416", email="ezezio416@gmail.com" }, | ||
| "Bug Tracker" = "https://github.com/ezio416/py416/issues" | ||
| [project.scripts] | ||
| rmd = "py416.scripts:rmd" | ||
| uzd = "py416.scripts:uzd" |
| Metadata-Version: 2.1 | ||
| Name: py416 | ||
| Version: 0.59 | ||
| Version: 0.60 | ||
| Summary: don't question my methods | ||
@@ -5,0 +5,0 @@ Author-email: Ezio416 <ezezio416@gmail.com> |
@@ -7,2 +7,3 @@ LICENSE | ||
| src/py416/general.py | ||
| src/py416/scripts.py | ||
| src/py416/sysinfo.py | ||
@@ -13,2 +14,3 @@ src/py416/variables.py | ||
| src/py416.egg-info/dependency_links.txt | ||
| src/py416.egg-info/entry_points.txt | ||
| src/py416.egg-info/requires.txt | ||
@@ -15,0 +17,0 @@ src/py416.egg-info/top_level.txt |
@@ -5,4 +5,4 @@ ''' | ||
| Created: 2022-08-15 | ||
| Updated: 2023-02-22 | ||
| Version: 0.59 | ||
| Updated: 2023-03-14 | ||
| Version: 0.60 | ||
@@ -12,3 +12,3 @@ A collection of various functions | ||
| from .general import * | ||
| __version__ = 0, 59 | ||
| __version__ = 0, 60 | ||
| v = __version__ |
| ''' | ||
| | Author: Ezio416 | ||
| | Created: 2022-08-16 | ||
| | Updated: 2023-02-22 | ||
| | Updated: 2023-03-14 | ||
@@ -1020,5 +1020,6 @@ - Functions for filesystem and path string manipulation | ||
| ''' | ||
| - unzips all archives in a folder (only 1st level) until it is unable to continue | ||
| - deletes all archives as it unzips | ||
| - supports archives of type: (.7z, .gz, .rar, .tar, .zip) | ||
| - unzips all archive files in a folder until it is unable to continue | ||
| - recursive on archive files, but not folders | ||
| - deletes all archive files as it unzips | ||
| - supports archive files of type: (.7z, .gz, .rar, .tar, .zip) | ||
@@ -1047,2 +1048,4 @@ Parameters | ||
| for file in listdir(path, dirs=False): | ||
| if not file.endswith(('.7z', '.gz', '.rar', '.tar', '.zip')): | ||
| continue | ||
| try: | ||
@@ -1052,7 +1055,7 @@ unzip(file, remove=True) | ||
| unzipped_this_run += 1 | ||
| except Exception: | ||
| except Exception as e: | ||
| if not bool(ignore_errors): | ||
| raise | ||
| raise Exception(f'unzipped {unzipped} archive file(s) before failing: {e}') | ||
| if not unzipped_this_run: | ||
| break | ||
| return unzipped |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
176260
1.16%20
11.11%2270
2.07%