403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.145.96.163
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/hc_python/lib/python3.8/site-packages/importlib_resources/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/hc_python/lib/python3.8/site-packages/importlib_resources/tests/zip.py
"""
Generate zip test data files.
"""

import contextlib
import os
import pathlib
import zipfile

import zipp


def make_zip_file(src, dst):
    """
    Zip the files in src into a new zipfile at dst.
    """
    with zipfile.ZipFile(dst, 'w') as zf:
        for src_path, rel in walk(src):
            dst_name = src.name / pathlib.PurePosixPath(rel.as_posix())
            zf.write(src_path, dst_name)
        zipp.CompleteDirs.inject(zf)
    return dst


def walk(datapath):
    for dirpath, dirnames, filenames in os.walk(datapath):
        with contextlib.suppress(ValueError):
            dirnames.remove('__pycache__')
        for filename in filenames:
            res = pathlib.Path(dirpath) / filename
            rel = res.relative_to(datapath)
            yield res, rel

Youez - 2016 - github.com/yon3zu
LinuXploit