allz


Nameallz JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/opendatalab/allz/
SummaryA universal command line tool for compression and decompression
upload_time2022-12-21 09:40:56
maintainer
docs_urlNone
authoropendatalab
requires_python>=3.7
license
keywords python compress decompress allz
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # A universal command line tool for compression and decompression


- Supports more normal compressed file formats than I can remember, like Zip, Tar, Gzip, Bzip2, 7-Zip, Rar, Rar.bz2, Tar.gz and so on.
- Supports split volumn compressed file for certain formats, like Tar.bz2, Tar.bz, Tar.gz, Tgz, Tar.7z, Tar, 7z, Zip, Rar.
- Supports decompress normal and split volumn compressed file in the same command. In split volumn mode, any part of the input split file can be decompress correctly.
- Support for automatic creation of target folders. If you have a path with spaces in it, it will handle that too.
- The decompress engine itself and command-line tool has only been tested in Linux environment so far.


## Install Cli
```bash
pip install allz
```

## Command Description
```bash
allz -d -q -f src_path -o dest_path
```
- src_path       The input source path.  
- dest_path    The output destination path.

- -d        Decompress normal or split compressed files.  
- -q        Run in quiet mode.  
- -f        Always overwrite files when a file to be unpacked already exists on disk. By default, the program will skips the file.
- -p        Output regular expressions for both regular compressed files and slice compressed files successively: the first line is for the normal compressed file, the second line is for the split volumn compressed file.
  - -p --only-normal    Output regular matching expressions for normal compressed files only.
  - -p --only-split       Output regular expressions for split volumn compressed files only.

### Available options:  
- --output-directory (-o) <string>  &emsp;&emsp;&ensp; The directory to write the contents of the archive to. Defaults to the current directory.

## Examples
####  Suppose we now have a normal compressed file MNIST.7z and two split volumn compressed files MNIST.tar.7z.001, MNIST.tar.7z.002.

#### 1. View the version  
```bash
allz --version
```

#### 2. View the help
```bash
allz -h
```
or 
```bash
allz --help
```

#### 3. Check which types are supported for decompression in your local environment
```bash
allz check
```

#### 4. Decompress the normal file MNIST.7z to current directory
```bash
allz -d MNIST.7z
```

In default, if the compressed file have already decompress before, it will skip the same file. You can use option -f to overwrite the files.
```bash
allz -d -f MNIST.7z
```

You can also mask screen log output by use option -q.
```bash
allz -d -q MNIST.7z
```

#### 5. Decompress the normal file MNIST.7z to the specified directory by use option -o
```bash
allz -d MNIST.7z -o /tmp
```

You can also use the relative destination path.
```bash
allz -d MNIST.7z -o ..
```

#### 6. Decompress the split volumn file MNIST.tar.7z.001
```bash
allz -d MNIST.tar.7z.001 
```

Decompress the split volumn file to specified directory by use option -o.
```bash
allz -d MNIST.tar.7z.001 -o /tmp
```

#### 7.Handle the path with space in it
Methods of using escapes
```bash
allz -d 20220101\ todo/MNIST.7z -o /tmp/20220101\ done/MNIST.7z
```
Methods of using quotation marks
```bash
allz -d "20220101 todo/MNIST.7z" -o "/tmp/20220101 done/MNIST.7z"
```

#### 8. Decompress the file into a recurvise destination directory
It will automatically create folders that do not exist.
```bash
allz -d MNIST.7z -o /tmp/today/fruit/apple/
```
  
  
## SDK
###  1. Function get_compressed_files_classify_lst
- Source code: allz/libs/file_type_tester  
- FileTypeTester.get_compressed_files_classify_lst(file_lst)
  - Return a nested list which will sort the input file list into multiple common or split volumn compressed file lists. The input parameter file_lst is a list of files in the same hierarchical directory. The list can be a file name, a full path or a relative path name. Function only processes compressed files, including normal compressed files and split volumn compressed files, ignoring the processing of normal files.

- A short usage example:
  ```python
    from allz.libs.file_type_tester import FileTypeTester

    file_lst = ["MNIST.tar.0000", "MNIST.tar.0001", "MNIST.tar.0002", "MNIST.tar.0003", "MNIST.tar.0004", "MNIST.tar.7z.001", "MNIST.tar.7z.002", "MNIST.part1.rar", "MNIST.part2.rar", "MNIST.part3.rar", "MNIST.part4.rar", "MNIST.7z.001", "MNIST.7z.002", "123.rar", "abc.zip", "abc", "000", "0000.tar", "02287.txt"]

    tester = FileTypeTester() 
    res_lst = tester.get_compressed_files_classify_lst(file_lst)
    print(res_lst)

  ```

  Output:  
  [['/home/work/srccode/github/allz/allz/libs/MNIST.tar.0000', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0002', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0004', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0003', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0001'], ['/home/work/srccode/github/allz/allz/libs/MNIST.tar.7z.002', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.7z.001'], ['/home/work/srccode/github/allz/allz/libs/MNIST.part4.rar', '/home/work/srccode/github/allz/allz/libs/MNIST.part1.rar', '/home/work/srccode/github/allz/allz/libs/MNIST.part2.rar', '/home/work/srccode/github/allz/allz/libs/MNIST.part3.rar'], ['/home/work/srccode/github/allz/allz/libs/MNIST.7z.001', '/home/work/srccode/github/allz/allz/libs/MNIST.7z.002'], ['/home/work/srccode/github/allz/allz/libs/123.rar'], ['/home/work/srccode/github/allz/allz/libs/000.tar']]

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/opendatalab/allz/",
    "name": "allz",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "python,compress,decompress,allz",
    "author": "opendatalab",
    "author_email": "yujia@pjlab.org.cn",
    "download_url": "https://files.pythonhosted.org/packages/2d/3e/2dcfd8b9184248311cb7b9b2142f0816941be20889ffae8c52b0e99e8e3b/allz-0.1.3.tar.gz",
    "platform": null,
    "description": "# A universal command line tool for compression and decompression\n\n\n- Supports more normal compressed file formats than I can remember, like Zip, Tar, Gzip, Bzip2, 7-Zip, Rar, Rar.bz2, Tar.gz and so on.\n- Supports split volumn compressed file for certain formats, like Tar.bz2, Tar.bz, Tar.gz, Tgz, Tar.7z, Tar, 7z, Zip, Rar.\n- Supports decompress normal and split volumn compressed file in the same command. In split volumn mode, any part of the input split file can be decompress correctly.\n- Support for automatic creation of target folders. If you have a path with spaces in it, it will handle that too.\n- The decompress engine itself and command-line tool has only been tested in Linux environment so far.\n\n\n## Install Cli\n```bash\npip install allz\n```\n\n## Command Description\n```bash\nallz -d -q -f src_path -o dest_path\n```\n- src_path  &emsp;&emsp;&nbsp;&nbsp; The input source path.  \n- dest_path &emsp;&emsp; The output destination path.\n\n- -d &emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; Decompress normal or split compressed files.  \n- -q &emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; Run in quiet mode.  \n- -f &emsp;&emsp;&emsp;&emsp;&emsp;&ensp; Always overwrite files when a file to be unpacked already exists on disk. By default, the program will skips the file.\n- -p &emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; Output regular expressions for both regular compressed files and slice compressed files successively: the first line is for the normal compressed file, the second line is for the split volumn compressed file.\n  - -p --only-normal &emsp;&emsp; Output regular matching expressions for normal compressed files only.\n  - -p --only-split  &emsp;&emsp;&emsp;&nbsp; Output regular expressions for split volumn compressed files only.\n\n### Available options:  \n- --output-directory (-o) <string>  &emsp;&emsp;&ensp; The directory to write the contents of the archive to. Defaults to the current directory.\n\n## Examples\n####  Suppose we now have a normal compressed file MNIST.7z and two split volumn compressed files MNIST.tar.7z.001, MNIST.tar.7z.002.\n\n#### 1. View the version  \n```bash\nallz --version\n```\n\n#### 2. View the help\n```bash\nallz -h\n```\nor \n```bash\nallz --help\n```\n\n#### 3. Check which types are supported for decompression in your local environment\n```bash\nallz check\n```\n\n#### 4. Decompress the normal file MNIST.7z to current directory\n```bash\nallz -d MNIST.7z\n```\n\nIn default, if the compressed file have already decompress before, it will skip the same file. You can use option -f to overwrite the files.\n```bash\nallz -d -f MNIST.7z\n```\n\nYou can also mask screen log output by use option -q.\n```bash\nallz -d -q MNIST.7z\n```\n\n#### 5. Decompress the normal file MNIST.7z to the specified directory by use option -o\n```bash\nallz -d MNIST.7z -o /tmp\n```\n\nYou can also use the relative destination path.\n```bash\nallz -d MNIST.7z -o ..\n```\n\n#### 6. Decompress the split volumn file MNIST.tar.7z.001\n```bash\nallz -d MNIST.tar.7z.001 \n```\n\nDecompress the split volumn file to specified directory by use option -o.\n```bash\nallz -d MNIST.tar.7z.001 -o /tmp\n```\n\n#### 7.Handle the path with space in it\nMethods of using escapes\n```bash\nallz -d 20220101\\ todo/MNIST.7z -o /tmp/20220101\\ done/MNIST.7z\n```\nMethods of using quotation marks\n```bash\nallz -d \"20220101 todo/MNIST.7z\" -o \"/tmp/20220101 done/MNIST.7z\"\n```\n\n#### 8. Decompress the file into a recurvise destination directory\nIt will automatically create folders that do not exist.\n```bash\nallz -d MNIST.7z -o /tmp/today/fruit/apple/\n```\n  \n  \n## SDK\n###  1. Function get_compressed_files_classify_lst\n- Source code: allz/libs/file_type_tester  \n- FileTypeTester.get_compressed_files_classify_lst(file_lst)\n  - Return a nested list which will sort the input file list into multiple common or split volumn compressed file lists. The input parameter file_lst is a list of files in the same hierarchical directory. The list can be a file name, a full path or a relative path name. Function only processes compressed files, including normal compressed files and split volumn compressed files, ignoring the processing of normal files.\n\n- A short usage example:\n  ```python\n    from allz.libs.file_type_tester import FileTypeTester\n\n    file_lst = [\"MNIST.tar.0000\", \"MNIST.tar.0001\", \"MNIST.tar.0002\", \"MNIST.tar.0003\", \"MNIST.tar.0004\", \"MNIST.tar.7z.001\", \"MNIST.tar.7z.002\", \"MNIST.part1.rar\", \"MNIST.part2.rar\", \"MNIST.part3.rar\", \"MNIST.part4.rar\", \"MNIST.7z.001\", \"MNIST.7z.002\", \"123.rar\", \"abc.zip\", \"abc\", \"000\", \"0000.tar\", \"02287.txt\"]\n\n    tester = FileTypeTester() \n    res_lst = tester.get_compressed_files_classify_lst(file_lst)\n    print(res_lst)\n\n  ```\n\n  Output:  \n  [['/home/work/srccode/github/allz/allz/libs/MNIST.tar.0000', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0002', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0004', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0003', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.0001'], ['/home/work/srccode/github/allz/allz/libs/MNIST.tar.7z.002', '/home/work/srccode/github/allz/allz/libs/MNIST.tar.7z.001'], ['/home/work/srccode/github/allz/allz/libs/MNIST.part4.rar', '/home/work/srccode/github/allz/allz/libs/MNIST.part1.rar', '/home/work/srccode/github/allz/allz/libs/MNIST.part2.rar', '/home/work/srccode/github/allz/allz/libs/MNIST.part3.rar'], ['/home/work/srccode/github/allz/allz/libs/MNIST.7z.001', '/home/work/srccode/github/allz/allz/libs/MNIST.7z.002'], ['/home/work/srccode/github/allz/allz/libs/123.rar'], ['/home/work/srccode/github/allz/allz/libs/000.tar']]\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A universal command line tool for compression and decompression",
    "version": "0.1.3",
    "split_keywords": [
        "python",
        "compress",
        "decompress",
        "allz"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "8518564e9264089e889cf076cfa86e10",
                "sha256": "eba31e206f6c50136898966311fa76b94ba7730c3411a3ff778d8362dedaa334"
            },
            "downloads": -1,
            "filename": "allz-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8518564e9264089e889cf076cfa86e10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 18749,
            "upload_time": "2022-12-21T09:40:55",
            "upload_time_iso_8601": "2022-12-21T09:40:55.022271Z",
            "url": "https://files.pythonhosted.org/packages/3a/9c/aa84e736b8b8fbf784b5ad4507d6d1a5b9ce2efa3e713dee78f6bad2b3a0/allz-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "0d27447062edddf4ad2b2305701fb180",
                "sha256": "13bdd8e1aa235b275e71856bd0741535c87790c0342c76d2f7b51e0f59906e6a"
            },
            "downloads": -1,
            "filename": "allz-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "0d27447062edddf4ad2b2305701fb180",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14175,
            "upload_time": "2022-12-21T09:40:56",
            "upload_time_iso_8601": "2022-12-21T09:40:56.937577Z",
            "url": "https://files.pythonhosted.org/packages/2d/3e/2dcfd8b9184248311cb7b9b2142f0816941be20889ffae8c52b0e99e8e3b/allz-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-21 09:40:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "opendatalab",
    "github_project": "allz",
    "lcname": "allz"
}
        
Elapsed time: 0.05735s