atomicshop 2.6.8__py3-none-any.whl → 2.6.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of atomicshop might be problematic. Click here for more details.
- atomicshop/__init__.py +1 -1
- atomicshop/addons/mains/FACT/update_extract.py +7 -0
- atomicshop/archiver/_search_in_zip.py +189 -0
- atomicshop/archiver/archiver.py +34 -0
- atomicshop/archiver/search_in_archive.py +234 -0
- atomicshop/archiver/sevenz.py +16 -0
- atomicshop/archiver/zip.py +283 -0
- atomicshop/basics/bytes_arrays.py +56 -12
- atomicshop/file_io/jsons.py +11 -0
- atomicshop/file_io/xmls.py +20 -9
- atomicshop/web.py +2 -2
- atomicshop/wrappers/configparserw.py +24 -11
- atomicshop/wrappers/factw/config_install.py +2 -0
- atomicshop/wrappers/githubw.py +2 -2
- {atomicshop-2.6.8.dist-info → atomicshop-2.6.10.dist-info}/METADATA +3 -2
- {atomicshop-2.6.8.dist-info → atomicshop-2.6.10.dist-info}/RECORD +19 -15
- atomicshop/archiver.py +0 -152
- {atomicshop-2.6.8.dist-info → atomicshop-2.6.10.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.6.8.dist-info → atomicshop-2.6.10.dist-info}/WHEEL +0 -0
- {atomicshop-2.6.8.dist-info → atomicshop-2.6.10.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=9skfrXZgzL0UdpuNxnyOTL32xpPNHpNNBvIb-fuE9KA,123
|
|
2
2
|
atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
|
|
3
3
|
atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
|
|
4
4
|
atomicshop/appointment_management.py,sha256=N3wVGJgrqJfsj_lqiRfaL3FxMEe57by5Stzanh189mk,7263
|
|
5
|
-
atomicshop/archiver.py,sha256=QuDKx6bJEM29u-7r2tsizXEEGJmPuv0Xm91JQOpg__8,7152
|
|
6
5
|
atomicshop/certificates.py,sha256=J-cmd6Rpq3zZyzsOH-GcdqIXdg2UwM8_E9mg7XtUph8,3787
|
|
7
6
|
atomicshop/command_line_processing.py,sha256=u5yT9Ger_cu7ni5ID0VFlRbVD46ARHeNC9tRM-_YXrQ,1038
|
|
8
7
|
atomicshop/config_init.py,sha256=z2RXD_mw9nQlAOpuGry1h9QT-2LhNscXgGAktN3dCVQ,2497
|
|
@@ -41,7 +40,7 @@ atomicshop/tempfiles.py,sha256=uq1ve2WlWehZ3NOTXJnpBBMt6HyCdBufqedF0HyzA6k,2517
|
|
|
41
40
|
atomicshop/timer.py,sha256=KxBBgVM8po6pUJDW8TgY1UXj0iiDmRmL5XDCq0VHAfU,1670
|
|
42
41
|
atomicshop/urls.py,sha256=CQl1j1kjEVDlAuYJqYD9XxPF1SUSgrmG8PjlcXNEKsQ,597
|
|
43
42
|
atomicshop/virtualization.py,sha256=LPP4vjE0Vr10R6DA4lqhfX_WaNdDGRAZUW0Am6VeGco,494
|
|
44
|
-
atomicshop/web.py,sha256=
|
|
43
|
+
atomicshop/web.py,sha256=K3UndqJqHO9bTogZUWDz-IEZN776KNhpk28m3Ct_pbc,11069
|
|
45
44
|
atomicshop/addons/PlayWrightCodegen.cmd,sha256=Z5cnllsyXD4F1W2h-WLEnyFkg5nZy0-hTGHRWXVOuW4,173
|
|
46
45
|
atomicshop/addons/ScriptExecution.cmd,sha256=8iC-uHs9MX9qUD_C2M7n9Xw4MZvwOfxT8H5v3hluVps,93
|
|
47
46
|
atomicshop/addons/a_setup_scripts/install_psycopg2_ubuntu.sh,sha256=lM7LkXQ2AxfFzDGyzSOfIS_zpg9bAD1k3JJ-qu5CdH8,81
|
|
@@ -50,7 +49,7 @@ atomicshop/addons/mains/install_docker_ubuntu_main_sudo.py,sha256=3VDGDO41Vubzf6
|
|
|
50
49
|
atomicshop/addons/mains/install_wsl_ubuntu_lts_admin.py,sha256=PrvZ4hMuadzj2GYKRZSwyNayJUuaSnCF9nV6ORqoPdo,123
|
|
51
50
|
atomicshop/addons/mains/search_for_hyperlinks_in_docx.py,sha256=HkIdo_Sz9nPbbbJf1mwfwFkyI7vkvpH8qiIkuYopN4w,529
|
|
52
51
|
atomicshop/addons/mains/FACT/factw_fact_extractor_docker_image_main_sudo.py,sha256=DDKX3Wp2SmzMCEtCIEOUbEKMob2ZQ7VEQGLEf9uYXrs,320
|
|
53
|
-
atomicshop/addons/mains/FACT/update_extract.py,sha256=
|
|
52
|
+
atomicshop/addons/mains/FACT/update_extract.py,sha256=H3VsdhlA7xxK5lI_nyrWUdk8GNZXbEUVR_K9cJ4ECAw,506
|
|
54
53
|
atomicshop/addons/mains/inits/init_to_import_all_modules.py,sha256=piyFjkqtNbM9PT2p8aGcatI615517XEQHgU9kDFwseY,559
|
|
55
54
|
atomicshop/addons/package_setup/CreateWheel.cmd,sha256=hq9aWBSH6iffYlZyaCNrFlA0vxMh3j1k8DQE8IARQuA,189
|
|
56
55
|
atomicshop/addons/package_setup/Setup in Edit mode.cmd,sha256=299RsExjR8Mup6YyC6rW0qF8lnwa3uIzwk_gYg_R_Ss,176
|
|
@@ -61,11 +60,16 @@ atomicshop/addons/process_list/process_list.cpp,sha256=e7olpLfLVg9vQnjEr5L2Y8aWG
|
|
|
61
60
|
atomicshop/addons/process_list/compiled/Win10x64/process_list.dll,sha256=SkAZvYAfSbzQTTq-5aL6_dYR2rA4DHbgyenFfgLFzW0,266752
|
|
62
61
|
atomicshop/addons/process_list/compiled/Win10x64/process_list.exp,sha256=VTph513eqa6f6HmqAj_6mBS1Rf9G56bgYqZNuDePYcs,708
|
|
63
62
|
atomicshop/addons/process_list/compiled/Win10x64/process_list.lib,sha256=n9c2MVPs3GBNoOQjMesAwzNpv5aFZsW8c-ADS7GYRhA,1886
|
|
63
|
+
atomicshop/archiver/_search_in_zip.py,sha256=dd8qFSvIhcKmtnPj_uYNJFPmMwZp4tZys0kKgTw_ACw,8385
|
|
64
|
+
atomicshop/archiver/archiver.py,sha256=BomnK7zT-nQXA1z0i2R2aTv8eu88wPx7tf2HtOdbmEc,1280
|
|
65
|
+
atomicshop/archiver/search_in_archive.py,sha256=iciz5nbtr0m2pAbWQRR7fH1Z7q9NFxfwRv8Vy_MH6pM,9630
|
|
66
|
+
atomicshop/archiver/sevenz.py,sha256=S90Nuc-Ay3spQBP-sZqasqoDIhJx331cPPyQ0uuylks,371
|
|
67
|
+
atomicshop/archiver/zip.py,sha256=ZbVMEMD4xSvddQWWCf73B7wYePWt354Qk1kib5bA--4,13959
|
|
64
68
|
atomicshop/basics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
69
|
atomicshop/basics/ansi_escape_codes.py,sha256=WtIkm-BjSZS5J5irDUdAMBNvdX-qXFZcTX98jcBMpJE,3140
|
|
66
70
|
atomicshop/basics/argparse_template.py,sha256=S-BIdKd45bmNdqO3Dj3yOxBgb0O90spZxG4OcnedBHw,5836
|
|
67
71
|
atomicshop/basics/booleans.py,sha256=-4JnSQ1pSb6CNY_62wtHBW8NltjPJEKM-gYOxFujunA,1772
|
|
68
|
-
atomicshop/basics/bytes_arrays.py,sha256=
|
|
72
|
+
atomicshop/basics/bytes_arrays.py,sha256=WvSRDhIGt1ywF95t-yNgpxLm1nlZUbM1Dz6QckcyE8Y,5915
|
|
69
73
|
atomicshop/basics/classes.py,sha256=-l0dqbKKDc89ABQ_wvELJub8gWl_J2MTmCEBVmAbTfk,8426
|
|
70
74
|
atomicshop/basics/dicts.py,sha256=sAoHvY-Rtt7QkwHzIKk1j2ZFmteIm9yFCxBGkTrpbdk,9030
|
|
71
75
|
atomicshop/basics/dicts_nested.py,sha256=StYxYnYPa0SEJr1lmEwAv5zfERWWqoULeyG8e0zRAwE,4107
|
|
@@ -91,10 +95,10 @@ atomicshop/file_io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
91
95
|
atomicshop/file_io/csvs.py,sha256=4R4Kij8FmxNwXFjDtlF_A0flAk0Hj5nZKlEnqC5VxgQ,3125
|
|
92
96
|
atomicshop/file_io/docxs.py,sha256=3IFtaurVhvntcuCL59bpFlzGyKxvDmVUjUQTHWluOMY,4369
|
|
93
97
|
atomicshop/file_io/file_io.py,sha256=FR84ihjGlr7Eqejo-_js4nBICVst31axD0bwX19S2eM,6385
|
|
94
|
-
atomicshop/file_io/jsons.py,sha256=
|
|
98
|
+
atomicshop/file_io/jsons.py,sha256=uj-YiK-GxI6qCHgMbvx8t2vzWKvRarrvvqoUq8HvD3A,4416
|
|
95
99
|
atomicshop/file_io/tomls.py,sha256=oa0Wm8yMkPRXKN9jgBuTnKbioSOee4mABW5IMUFCYyU,3041
|
|
96
100
|
atomicshop/file_io/xlsxs.py,sha256=v_dyg9GD4LqgWi6wA1QuWRZ8zG4ZwB6Dz52ytdcmmmI,2184
|
|
97
|
-
atomicshop/file_io/xmls.py,sha256=
|
|
101
|
+
atomicshop/file_io/xmls.py,sha256=zh3SuK-dNaFq2NDNhx6ivcf4GYCfGM8M10PcEwDSpxk,2104
|
|
98
102
|
atomicshop/mitm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
99
103
|
atomicshop/mitm/connection_thread_worker.py,sha256=7f7T3t6ltndzb3125DgyRTzsD-oAbAfewDIhpNEeHRY,20630
|
|
100
104
|
atomicshop/mitm/import_config.py,sha256=BPZ62ozMUaUKn7Crt6dhzvUgD3dSKd17kMfbJNObvlI,7486
|
|
@@ -130,10 +134,10 @@ atomicshop/wrappers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
130
134
|
atomicshop/wrappers/_process_wrapper_curl.py,sha256=XkZZXYl7D0Q6UfdWqy-18AvpU0yVp9i2BVD2qRcXlkk,841
|
|
131
135
|
atomicshop/wrappers/_process_wrapper_tar.py,sha256=WUMZFKNrlG4nJP9tWZ51W7BR1j_pIjsjgyAStmWjRGs,655
|
|
132
136
|
atomicshop/wrappers/astw.py,sha256=VkYfkfyc_PJLIOxByT6L7B8uUmKY6-I8XGZl4t_z828,4239
|
|
133
|
-
atomicshop/wrappers/configparserw.py,sha256=
|
|
137
|
+
atomicshop/wrappers/configparserw.py,sha256=JwDTPjZoSrv44YKwIRcjyUnpN-FjgXVfMqMK_tJuSgU,22800
|
|
134
138
|
atomicshop/wrappers/cryptographyw.py,sha256=H5NaHHDkr97QYhUrHFO9vY218u8k3N3Zgh6bQRnicUE,13140
|
|
135
139
|
atomicshop/wrappers/ffmpegw.py,sha256=YKptcdNQC1wyPLRLvc24fIPr4_rj8IHH01UUzt6XFO0,6039
|
|
136
|
-
atomicshop/wrappers/githubw.py,sha256=
|
|
140
|
+
atomicshop/wrappers/githubw.py,sha256=AjD0VUlV2Kcddns2OaGmyX-FOAvdps-8SPSWS05E0QA,4809
|
|
137
141
|
atomicshop/wrappers/numpyw.py,sha256=sBV4gSKyr23kXTalqAb1oqttzE_2XxBooCui66jbAqc,1025
|
|
138
142
|
atomicshop/wrappers/process_wrapper_pbtk.py,sha256=ycPmBRnv627RWks6N8OhxJQe8Gu3h3Vwj-4HswPOw0k,599
|
|
139
143
|
atomicshop/wrappers/psutilw.py,sha256=W9PSEZmrm_Ct_-6oKqAcbgbyF21CwcIbbHOkVqgMiow,20866
|
|
@@ -148,7 +152,7 @@ atomicshop/wrappers/dockerw/dockerw.py,sha256=8MZCMek6L-QpawO5hn_gxXczI6ustPGcYB
|
|
|
148
152
|
atomicshop/wrappers/dockerw/install_docker.py,sha256=dpSOmD690oLukoLCo0u6Pzh5fRyCWBuSQEtG8VwC3jk,2765
|
|
149
153
|
atomicshop/wrappers/factw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
154
|
atomicshop/wrappers/factw/config_fact.py,sha256=J-K9Zn50WcDC7ubb-boraSZExfBk7a6M52NhRJVlsjk,895
|
|
151
|
-
atomicshop/wrappers/factw/config_install.py,sha256=
|
|
155
|
+
atomicshop/wrappers/factw/config_install.py,sha256=QRygFnZ5r1ybJQl7ftFci3kNRmU-a-w3lMG1joElvcY,417
|
|
152
156
|
atomicshop/wrappers/factw/get_file_data.py,sha256=ChKC0OjgjFlNubZQBwcGhRO3L2pccc27RLRlAMIUix4,1641
|
|
153
157
|
atomicshop/wrappers/factw/fact_extractor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
154
158
|
atomicshop/wrappers/factw/fact_extractor/docker_image.py,sha256=v6ZSG8lnagTwOWOcPszlNRqPWuCzXScuw72XEXAq8YU,2519
|
|
@@ -204,8 +208,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
|
|
|
204
208
|
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
|
|
205
209
|
atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
|
|
206
210
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
|
|
207
|
-
atomicshop-2.6.
|
|
208
|
-
atomicshop-2.6.
|
|
209
|
-
atomicshop-2.6.
|
|
210
|
-
atomicshop-2.6.
|
|
211
|
-
atomicshop-2.6.
|
|
211
|
+
atomicshop-2.6.10.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
212
|
+
atomicshop-2.6.10.dist-info/METADATA,sha256=-FyCSXYkKw8NSSUg-_7j5_1PtbZzOPQ559E5nENaStc,10311
|
|
213
|
+
atomicshop-2.6.10.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
214
|
+
atomicshop-2.6.10.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
215
|
+
atomicshop-2.6.10.dist-info/RECORD,,
|
atomicshop/archiver.py
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import time
|
|
3
|
-
import shutil
|
|
4
|
-
import zipfile
|
|
5
|
-
|
|
6
|
-
from .print_api import print_api
|
|
7
|
-
from . import filesystem
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def is_zip_zipfile(file_path: str) -> bool:
|
|
11
|
-
"""
|
|
12
|
-
Function checks if the file is a zip file.
|
|
13
|
-
:param file_path: string, full path to the file.
|
|
14
|
-
:return: boolean.
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
try:
|
|
18
|
-
with zipfile.ZipFile(file_path) as zip_object:
|
|
19
|
-
zip_object.testzip()
|
|
20
|
-
return True
|
|
21
|
-
except zipfile.BadZipFile:
|
|
22
|
-
return False
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def is_zip_magic_number(file_path: str) -> bool:
|
|
26
|
-
"""
|
|
27
|
-
Function checks if the file is a zip file using magic number.
|
|
28
|
-
:param file_path: string, full path to the file.
|
|
29
|
-
:return: boolean.
|
|
30
|
-
|
|
31
|
-
50 4B 03 04: This is the most common signature, found at the beginning of a ZIP file.
|
|
32
|
-
It signifies the start of a file within the ZIP archive and is present in almost all ZIP files.
|
|
33
|
-
Each file within the ZIP archive starts with this signature.
|
|
34
|
-
50 4B 05 06: This is the end of central directory record signature.
|
|
35
|
-
It's found at the end of a ZIP file and is essential for identifying the structure of the ZIP archive,
|
|
36
|
-
especially in cases where the file is split or is a multi-part archive.
|
|
37
|
-
50 4B 07 08: This signature is used for spanned ZIP archives (also known as split or multi-volume ZIP archives).
|
|
38
|
-
It's found in the end of central directory locator for ZIP files that are split across multiple volumes.
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
with open(file_path, 'rb') as file:
|
|
42
|
-
# Read the first 4 bytes of the file
|
|
43
|
-
signature = file.read(4)
|
|
44
|
-
|
|
45
|
-
# Check if the signature matches any of the ZIP signatures
|
|
46
|
-
return signature in [b'PK\x03\x04', b'PK\x05\x06', b'PK\x07\x08']
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def extract_archive_with_shutil(file_path: str, target_directory: str, **kwargs) -> str:
|
|
50
|
-
"""
|
|
51
|
-
Function extracts the archive to target directory.
|
|
52
|
-
Returns full path to extracted directory.
|
|
53
|
-
This function doesn't preserve the original date and time of files from the archive, instead the time of extraction
|
|
54
|
-
will be applied.
|
|
55
|
-
|
|
56
|
-
:param file_path: Full file path to archived file to extract.
|
|
57
|
-
:param target_directory: The directory on the filesystem to extract the file to.
|
|
58
|
-
:return: str.
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
print_api(f'Extracting {file_path}', **kwargs)
|
|
62
|
-
|
|
63
|
-
extracted_directory: str = str()
|
|
64
|
-
|
|
65
|
-
try:
|
|
66
|
-
shutil.unpack_archive(file_path, target_directory)
|
|
67
|
-
file_name = file_path.rsplit(os.sep, maxsplit=1)[1]
|
|
68
|
-
file_name_no_extension = file_name.rsplit('.', maxsplit=1)[0]
|
|
69
|
-
extracted_directory: str = target_directory + os.sep + file_name_no_extension
|
|
70
|
-
except Exception as exception_object:
|
|
71
|
-
print_api(f'Error extracting: {file_path}', error_type=True, **kwargs)
|
|
72
|
-
print_api(exception_object, error_type=True, **kwargs)
|
|
73
|
-
pass
|
|
74
|
-
|
|
75
|
-
print_api(f'Extracted to: {extracted_directory}', **kwargs)
|
|
76
|
-
return extracted_directory
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def extract_archive_with_zipfile(
|
|
80
|
-
archive_path: str,
|
|
81
|
-
extract_directory: str = None,
|
|
82
|
-
files_without_directories: bool = False,
|
|
83
|
-
remove_first_directory: bool = False,
|
|
84
|
-
print_kwargs: dict = None
|
|
85
|
-
) -> str:
|
|
86
|
-
"""
|
|
87
|
-
Function will extract the archive using standard library 'zipfile'.
|
|
88
|
-
This method preserves original date and time of the files inside the archive.
|
|
89
|
-
|
|
90
|
-
:param archive_path: string, full path to archived file.
|
|
91
|
-
:param extract_directory: string, full path to directory that the files will be extracted to.
|
|
92
|
-
If not specified, the files will be extracted to the same directory as the archived file, using the file name
|
|
93
|
-
without extension as the directory name.
|
|
94
|
-
:param files_without_directories: boolean, default 'False'.
|
|
95
|
-
'True': All the files in the archive will be extracted without subdirectories hierarchy.
|
|
96
|
-
Meaning, that if there are duplicate file names, the latest file with the same file name will overwrite
|
|
97
|
-
all the rest of the files with the same name.
|
|
98
|
-
'False': Subdirectory hierarchy will be preserved as it is currently in the archived file.
|
|
99
|
-
:param remove_first_directory: boolean, default is 'False'.
|
|
100
|
-
'True': all the files will be extracted without first directory in the hierarchy.
|
|
101
|
-
Example: package_some_name_1.1.1_build/subdir1/file.exe
|
|
102
|
-
Will be extracted as: subdir/file.exe
|
|
103
|
-
:param print_kwargs: dict, kwargs for print_api.
|
|
104
|
-
|
|
105
|
-
:return: string, full path to directory that the files were extracted to.
|
|
106
|
-
"""
|
|
107
|
-
|
|
108
|
-
if print_kwargs is None:
|
|
109
|
-
print_kwargs = dict()
|
|
110
|
-
|
|
111
|
-
# If 'extract_directory' is not specified, extract to the same directory as the archived file.
|
|
112
|
-
if extract_directory is None:
|
|
113
|
-
extract_directory = (
|
|
114
|
-
filesystem.get_file_directory(archive_path) + os.sep +
|
|
115
|
-
filesystem.get_file_name_without_extension(archive_path))
|
|
116
|
-
|
|
117
|
-
print_api(f'Extracting to directory: {extract_directory}', **print_kwargs)
|
|
118
|
-
|
|
119
|
-
# initiating the archived file path as 'zipfile.ZipFile' object.
|
|
120
|
-
with zipfile.ZipFile(archive_path) as zip_object:
|
|
121
|
-
# '.infolist()' method of the object contains all the directories and files that are in the archive including
|
|
122
|
-
# information about each one, like date and time of archiving.
|
|
123
|
-
for zip_info in zip_object.infolist():
|
|
124
|
-
# '.filename' attribute of the 'infolist()' method is relative path to each directory and file.
|
|
125
|
-
# If 'filename' ends with '/' it is a directory (it doesn't matter if it is windows or *nix)
|
|
126
|
-
# If so, skip current iteration.
|
|
127
|
-
if zip_info.filename[-1] == '/':
|
|
128
|
-
continue
|
|
129
|
-
|
|
130
|
-
if files_without_directories:
|
|
131
|
-
# Put into 'filename' the string that contains only the filename without subdirectories.
|
|
132
|
-
zip_info.filename = os.path.basename(zip_info.filename)
|
|
133
|
-
elif remove_first_directory:
|
|
134
|
-
# Cut the first directory from the filename.
|
|
135
|
-
zip_info.filename = zip_info.filename.split('/', maxsplit=1)[1]
|
|
136
|
-
|
|
137
|
-
print_api(f'Extracting: {zip_info.filename}', **print_kwargs)
|
|
138
|
-
|
|
139
|
-
# Extract current file from the archive using 'zip_info' of the current file with 'filename' that we
|
|
140
|
-
# updated under specified parameters to specified directory.
|
|
141
|
-
zip_object.extract(zip_info, extract_directory)
|
|
142
|
-
|
|
143
|
-
# === Change the date and time of extracted file from current time to the time specified in 'zip_info'.
|
|
144
|
-
# Get full path to extracted file.
|
|
145
|
-
extracted_file_path: str = extract_directory + os.sep + zip_info.filename
|
|
146
|
-
# Create needed datetime object with original archived datetime from 'zip_info.date_time'.
|
|
147
|
-
date_time = time.mktime(zip_info.date_time + (0, 0, -1))
|
|
148
|
-
# Using 'os' library, changed the datetime of the file to the object created in previous step.
|
|
149
|
-
os.utime(extracted_file_path, (date_time, date_time))
|
|
150
|
-
print_api('Extraction done.', color="green", **print_kwargs)
|
|
151
|
-
|
|
152
|
-
return extract_directory
|
|
File without changes
|
|
File without changes
|
|
File without changes
|