MainShortcuts2 2.8.5__tar.gz → 2.8.7__tar.gz
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.
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/PKG-INFO +1 -1
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/pyproject.toml +1 -1
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/_module_info.py +1 -1
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/pathlib_ex.py +96 -2
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/java_ext/__init__.py +58 -20
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/path.py +9 -32
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/README.md +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/__init__.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/__main__.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/_any2json_regs.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/_ms2app_regs.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/_ms2dat_auto.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/advanced.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/any2json.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/base.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/gigachat.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/github.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/russian_trusted_root_ca_pem.crt +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/russian_trusted_sub_ca_pem.crt +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/webdav.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/cfg.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/core.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/core_config.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/dict.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/dir.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/__init__.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/aiohttp_ex/web/__init__.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/aiohttp_ex/web/__main__.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/datetime_ex.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/pil_ex.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/psutil_ex.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/sqlite_ex.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/urlparse_ex.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/file.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/gui_scripts/__init__.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/gui_scripts/ms2_hash_gen.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/gui_scripts/utils.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/java_ext/ms2ext.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/json.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/linux.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/list.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ms2app.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ms2dat1.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ms2hash.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/proc.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/regex.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/special_chars.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/sql/_sql_base.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/sql/mysql.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/sql/postgresql.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/sql/sqlite.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/str.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/term.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/types.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/utils.py +0 -0
- {mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/win.py +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
name = 'mainshortcuts2'
|
|
2
|
-
version = '2.8.
|
|
2
|
+
version = '2.8.7'
|
|
@@ -2,13 +2,23 @@ import os
|
|
|
2
2
|
import pathlib
|
|
3
3
|
import shutil
|
|
4
4
|
import typing
|
|
5
|
+
import enum
|
|
6
|
+
from functools import cached_property
|
|
5
7
|
from MainShortcuts2 import ms
|
|
6
8
|
from os import fspath
|
|
7
9
|
from stat import S_ISDIR, S_ISREG
|
|
8
10
|
|
|
9
11
|
|
|
12
|
+
class ms2hash_version(enum.IntEnum):
|
|
13
|
+
LEGACY = enum.auto()
|
|
14
|
+
V0 = enum.auto()
|
|
15
|
+
VA = enum.auto()
|
|
16
|
+
VB = enum.auto()
|
|
17
|
+
VH = enum.auto()
|
|
18
|
+
|
|
19
|
+
|
|
10
20
|
class Path(pathlib.Path):
|
|
11
|
-
@
|
|
21
|
+
@cached_property
|
|
12
22
|
def ms_path(self):
|
|
13
23
|
"""Объект `ms.path.Path`"""
|
|
14
24
|
return ms.path.Path(self)
|
|
@@ -171,4 +181,88 @@ class Path(pathlib.Path):
|
|
|
171
181
|
|
|
172
182
|
def read_ms2dat(self, **kw):
|
|
173
183
|
"""Прочитать данные в формате MS2Dat"""
|
|
174
|
-
ms.ms2dat.read_file(self, **kw)
|
|
184
|
+
return ms.ms2dat.read_file(self, **kw)
|
|
185
|
+
|
|
186
|
+
def copy_to_io(self, fdest: typing.BinaryIO):
|
|
187
|
+
"""Скопировать содержимое в открытый файл"""
|
|
188
|
+
with self.open("rb") as fsrc:
|
|
189
|
+
shutil.copyfileobj(fsrc, fdest)
|
|
190
|
+
|
|
191
|
+
def _compress(self, opn: typing.Callable[[typing.Self], typing.BinaryIO], suffix: str, dest: os.PathLike = None, keep=False, **kw):
|
|
192
|
+
if dest is None:
|
|
193
|
+
dest = self.with_name(self.name + suffix)
|
|
194
|
+
else:
|
|
195
|
+
dest = type(self)(dest)
|
|
196
|
+
with opn(dest, **kw) as f:
|
|
197
|
+
self.copy_to_io(f)
|
|
198
|
+
if not keep:
|
|
199
|
+
self.unlink()
|
|
200
|
+
return dest
|
|
201
|
+
|
|
202
|
+
def compress_bz2(self, dest=None, keep=False, **kw):
|
|
203
|
+
"""Сжать через bzip2"""
|
|
204
|
+
import bz2
|
|
205
|
+
return self._compress(bz2.open, ".bz2", dest, keep, mode="wb", **kw)
|
|
206
|
+
|
|
207
|
+
def compress_gzip(self, dest=None, keep=False, **kw):
|
|
208
|
+
"""Сжать через gzip"""
|
|
209
|
+
import gzip
|
|
210
|
+
return self._compress(gzip.open, ".gz", dest, keep, mode="wb", **kw)
|
|
211
|
+
|
|
212
|
+
def compress_lzma(self, dest=None, keep=False, **kw):
|
|
213
|
+
"""Сжать через lzma"""
|
|
214
|
+
import lzma
|
|
215
|
+
return self._compress(lzma.open, ".lzma", dest, keep, mode="wb", **kw)
|
|
216
|
+
|
|
217
|
+
def compress_zstd(self, dest=None, keep=False, **kw):
|
|
218
|
+
"""Сжать через zstandard"""
|
|
219
|
+
import zstandard
|
|
220
|
+
return self._compress(zstandard.open, ".zst", dest, keep, mode="wb", **kw)
|
|
221
|
+
|
|
222
|
+
def hash(self, alg: str, bufsize=2**18):
|
|
223
|
+
"""Хешировать файл одним алгоритмом"""
|
|
224
|
+
import hashlib
|
|
225
|
+
with self.open("rb") as f:
|
|
226
|
+
return hashlib.file_digest(f, alg, _bufsize=bufsize).digest()
|
|
227
|
+
|
|
228
|
+
def hash_multi(self, algs: set[str], bufsize=2**18) -> dict[str, bytes]:
|
|
229
|
+
"""Хешировать файл несколькими алгоритмами"""
|
|
230
|
+
if not algs:
|
|
231
|
+
return {}
|
|
232
|
+
import hashlib
|
|
233
|
+
hashes = {i: hashlib.new(i) for i in algs}
|
|
234
|
+
updaters = [i.update for i in hashes.values()]
|
|
235
|
+
with self.open("rb") as f:
|
|
236
|
+
read = f.read
|
|
237
|
+
while True:
|
|
238
|
+
buf = read(bufsize)
|
|
239
|
+
if not buf:
|
|
240
|
+
break
|
|
241
|
+
for upd in updaters:
|
|
242
|
+
upd(buf)
|
|
243
|
+
return {k: v.digest() for k, v in hashes.items()}
|
|
244
|
+
|
|
245
|
+
def generate_ms2hash(self, alg="sha3-256", overwrite=False, version=ms2hash_version.LEGACY, **kw):
|
|
246
|
+
"""Сгенерировать файл хеша рядом с этим файлом. **Внимание**: версия по умолчанию изменится в будущем обновлении"""
|
|
247
|
+
if version == ms2hash_version.LEGACY:
|
|
248
|
+
dest = self.with_name(self.name + ms.ms2hash.HASH_SUFFIX)
|
|
249
|
+
if dest.exists() and not overwrite:
|
|
250
|
+
raise FileExistsError(dest)
|
|
251
|
+
hash = ms.ms2hash.Format1.generate(self, **kw)
|
|
252
|
+
return dest.write_json(hash.to_dict())
|
|
253
|
+
from MPL import ms2hash # WIP, скоро будет в MS2
|
|
254
|
+
if version == ms2hash_version.V0:
|
|
255
|
+
v = ms2hash.VERSION_0
|
|
256
|
+
elif version == ms2hash_version.VA:
|
|
257
|
+
v = ms2hash.VERSION_A
|
|
258
|
+
elif version == ms2hash_version.VB:
|
|
259
|
+
v = ms2hash.VERSION_B
|
|
260
|
+
elif version == ms2hash_version.VH:
|
|
261
|
+
v = ms2hash.VERSION_H
|
|
262
|
+
else:
|
|
263
|
+
raise ValueError("Invalid hash version: %s" % version)
|
|
264
|
+
dest = self.with_name(self.name + ms2hash.FILE_SUFFIX)
|
|
265
|
+
if dest.exists() and not overwrite:
|
|
266
|
+
raise FileExistsError(dest)
|
|
267
|
+
hash = ms2hash.HashInfo.from_file(alg, self, **kw)
|
|
268
|
+
return dest.write_bytes(hash.to_auto(v))
|
|
@@ -39,7 +39,10 @@ def _parse_java_version(text: str):
|
|
|
39
39
|
return list(map(int, text.split("_", 1)[0].split(".")))
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
_java_version_cache: dict[str, list[int]] = {}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _detect_java_version(file: Path):
|
|
43
46
|
release_file = file.parent.parent / "release"
|
|
44
47
|
if release_file.exists():
|
|
45
48
|
try:
|
|
@@ -58,13 +61,21 @@ def detect_java_version(file: Path):
|
|
|
58
61
|
raise RuntimeError("Couldn't determine the Java version") from None
|
|
59
62
|
|
|
60
63
|
|
|
64
|
+
def detect_java_version(file: Path):
|
|
65
|
+
file = file.resolve()
|
|
66
|
+
version = _java_version_cache.get(os.fspath(file))
|
|
67
|
+
if not version:
|
|
68
|
+
version = _java_version_cache[os.fspath(file)] = _detect_java_version(file)
|
|
69
|
+
return version
|
|
70
|
+
|
|
71
|
+
|
|
61
72
|
class IncompatibleJava(Exception):
|
|
62
73
|
pass
|
|
63
74
|
|
|
64
75
|
|
|
65
76
|
class InfoDict(dict):
|
|
66
77
|
@property
|
|
67
|
-
def builded_at(self):
|
|
78
|
+
def builded_at(self) -> int:
|
|
68
79
|
"""Дата сборки релиза (Unix timestamp)"""
|
|
69
80
|
return self["builded_at"]
|
|
70
81
|
|
|
@@ -89,17 +100,17 @@ class InfoDict(dict):
|
|
|
89
100
|
return self.get("max_java_version")
|
|
90
101
|
|
|
91
102
|
@property
|
|
92
|
-
def name(self):
|
|
103
|
+
def name(self) -> str:
|
|
93
104
|
"""Название"""
|
|
94
105
|
return self["name"]
|
|
95
106
|
|
|
96
107
|
@property
|
|
97
|
-
def version(self):
|
|
108
|
+
def version(self) -> str:
|
|
98
109
|
"""Название версии"""
|
|
99
110
|
return self["version"]
|
|
100
111
|
|
|
101
112
|
@property
|
|
102
|
-
def version_id(self):
|
|
113
|
+
def version_id(self) -> int:
|
|
103
114
|
"""ID версии"""
|
|
104
115
|
return self["version_id"]
|
|
105
116
|
|
|
@@ -121,6 +132,11 @@ class InfoDict(dict):
|
|
|
121
132
|
"""Проверить находится ли ID версии в диапазоне"""
|
|
122
133
|
return bool(min_id <= self.version_id < max_id)
|
|
123
134
|
|
|
135
|
+
@property
|
|
136
|
+
def dependencies(self) -> list[tuple[str, str, str]]:
|
|
137
|
+
"""Зависимости"""
|
|
138
|
+
return self.get("dependencies") or []
|
|
139
|
+
|
|
124
140
|
|
|
125
141
|
class JavaExtManager(ms.ObjectBase):
|
|
126
142
|
"""Менеджер версий JAR файла с кешированием"""
|
|
@@ -131,8 +147,7 @@ class JavaExtManager(ms.ObjectBase):
|
|
|
131
147
|
self.version_cache: "dict[str,JavaExtVersion]" = {}
|
|
132
148
|
|
|
133
149
|
@cached_property
|
|
134
|
-
def
|
|
135
|
-
"""Папка кеша"""
|
|
150
|
+
def root_dir(self):
|
|
136
151
|
plat = ms.advanced.get_platform()
|
|
137
152
|
if plat.is_mustdie:
|
|
138
153
|
if os.environ.get("LOCALAPPDATA"):
|
|
@@ -144,7 +159,16 @@ class JavaExtManager(ms.ObjectBase):
|
|
|
144
159
|
base = Path(os.environ["XDG_DATA_HOME"])
|
|
145
160
|
else:
|
|
146
161
|
base = Path.home() / ".local/share"
|
|
147
|
-
|
|
162
|
+
return base / "MainPlay_TG/MainShortcuts2/java_ext_cache_v1"
|
|
163
|
+
|
|
164
|
+
@cached_property
|
|
165
|
+
def lib_dir(self):
|
|
166
|
+
return self.root_dir / "lib"
|
|
167
|
+
|
|
168
|
+
@cached_property
|
|
169
|
+
def dir(self):
|
|
170
|
+
"""Папка кеша"""
|
|
171
|
+
result = self.root_dir / self.repo[0] / self.repo[1]
|
|
148
172
|
return result.resolve().any_mkdir()
|
|
149
173
|
|
|
150
174
|
def get_version(self, version_name: str):
|
|
@@ -155,6 +179,14 @@ class JavaExtManager(ms.ObjectBase):
|
|
|
155
179
|
self.version_cache[version_name] = version
|
|
156
180
|
return self.version_cache[version_name]
|
|
157
181
|
|
|
182
|
+
def get_lib(self, group_id: str, artifact_id: str, version: str):
|
|
183
|
+
filename = f"{group_id.replace(".", "/")}/{artifact_id}/{version}/{artifact_id}-{version}.jar"
|
|
184
|
+
file = self.lib_dir / filename
|
|
185
|
+
if not file.exists():
|
|
186
|
+
file.parent.any_mkdir()
|
|
187
|
+
ms.utils.download_file(f"https://repo1.maven.org/maven2/{filename}", file, session=self.gh.http)
|
|
188
|
+
return file
|
|
189
|
+
|
|
158
190
|
def iter_online_releases(self, count=github.MAX_PER_PAGE):
|
|
159
191
|
"""Итерация релизов с GitHub"""
|
|
160
192
|
return self.gh.releases.list_iter(*self.repo, count)
|
|
@@ -307,33 +339,39 @@ class JavaExtVersion(ms.ObjectBase):
|
|
|
307
339
|
if not keep_info:
|
|
308
340
|
self.info_path.remove()
|
|
309
341
|
|
|
310
|
-
def _popen(self, args, **kw):
|
|
342
|
+
def _popen(self, args, classpath: list[Path] = None, **kw):
|
|
311
343
|
if not self._java_checked:
|
|
312
344
|
self.info.check_java_file(self.java_bin)
|
|
313
345
|
self._java_checked = True
|
|
314
|
-
|
|
346
|
+
cp = os.path.pathsep.join(map(os.fspath, [*self.dependencies_files, *(classpath or [])]))
|
|
347
|
+
return subprocess.Popen([str(self.java_bin), "-cp", cp, *args], **kw)
|
|
315
348
|
|
|
316
|
-
def _run(self, args, **kw) -> subprocess.CompletedProcess:
|
|
349
|
+
def _run(self, args, classpath: list[Path] = None, **kw) -> subprocess.CompletedProcess:
|
|
317
350
|
kw.setdefault("check", True)
|
|
318
351
|
if not self._java_checked:
|
|
319
352
|
self.info.check_java_file(self.java_bin)
|
|
320
353
|
self._java_checked = True
|
|
321
|
-
|
|
354
|
+
cp = os.path.pathsep.join(map(os.fspath, [*self.dependencies_files, *(classpath or [])]))
|
|
355
|
+
return subprocess.run([str(self.java_bin), "-cp", cp, *args], **kw)
|
|
322
356
|
|
|
323
|
-
def popen_class_raw(self,
|
|
324
|
-
return self._popen([
|
|
357
|
+
def popen_class_raw(self, class_name: str, args: list[str] = [], **kw):
|
|
358
|
+
return self._popen([class_name, *args], [self.jar_path], **kw)
|
|
325
359
|
|
|
326
|
-
def popen_class(self,
|
|
327
|
-
return self.popen_class_raw(self.info.classes[
|
|
360
|
+
def popen_class(self, class_alias: str, args: list[str] = [], **kw):
|
|
361
|
+
return self.popen_class_raw(self.info.classes[class_alias], args, **kw)
|
|
328
362
|
|
|
329
363
|
def popen(self, args: list[str], **kw):
|
|
330
364
|
return self._popen(["-jar", str(self.jar_path), *args], **kw)
|
|
331
365
|
|
|
332
|
-
def run_class_raw(self,
|
|
333
|
-
return self._run([
|
|
366
|
+
def run_class_raw(self, class_name: str, args: list[str] = [], **kw):
|
|
367
|
+
return self._run([class_name, *args], [self.jar_path], **kw)
|
|
334
368
|
|
|
335
|
-
def run_class(self,
|
|
336
|
-
return self.run_class_raw(self.info.classes[
|
|
369
|
+
def run_class(self, class_alias: str, args: list[str] = [], **kw):
|
|
370
|
+
return self.run_class_raw(self.info.classes[class_alias], args, **kw)
|
|
337
371
|
|
|
338
372
|
def run(self, args: list[str], **kw):
|
|
339
373
|
return self._run(["-jar", str(self.jar_path), *args], **kw)
|
|
374
|
+
|
|
375
|
+
@cached_property
|
|
376
|
+
def dependencies_files(self):
|
|
377
|
+
return [self.mgr.get_lib(*i) for i in self.info.dependencies]
|
|
@@ -337,47 +337,24 @@ class Path(os.PathLike):
|
|
|
337
337
|
"""Открыть файл на чтение/запись"""
|
|
338
338
|
return open(self.path, mode, **kw)
|
|
339
339
|
|
|
340
|
-
def hash(self, algorithm: str, chunk_size=ms.file.CHUNK_SIZE)
|
|
340
|
+
def hash(self, algorithm: str, chunk_size=ms.file.CHUNK_SIZE):
|
|
341
341
|
"""Хеш файла (`bytes`)"""
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
rf = f.read # read func
|
|
346
|
-
uf = hash.update # update func
|
|
347
|
-
while True:
|
|
348
|
-
b = rf(chunk_size)
|
|
349
|
-
if not b:
|
|
350
|
-
break
|
|
351
|
-
uf(b)
|
|
352
|
-
return hash.digest()
|
|
353
|
-
|
|
354
|
-
def hash_hex(self, algorithm: str, **kw) -> str:
|
|
342
|
+
return self.pathlib_path.hash(algorithm, bufsize=chunk_size)
|
|
343
|
+
|
|
344
|
+
def hash_hex(self, algorithm: str, **kw):
|
|
355
345
|
"""Хеш файла (`bytes.hex()`)"""
|
|
356
346
|
return self.hash(algorithm, **kw).hex()
|
|
357
347
|
|
|
358
|
-
def hash_b85(self, algorithm: str, **kw)
|
|
348
|
+
def hash_b85(self, algorithm: str, **kw):
|
|
359
349
|
"""Хеш файла (`base85`)"""
|
|
360
350
|
from base64 import b85encode
|
|
361
351
|
return b85encode(self.hash(algorithm, **kw)).decode()
|
|
362
352
|
|
|
363
|
-
def multi_hash(self, algorithms: list[str], chunk_size=ms.file.CHUNK_SIZE)
|
|
353
|
+
def multi_hash(self, algorithms: list[str], chunk_size=ms.file.CHUNK_SIZE):
|
|
364
354
|
"""Хеш файла (`bytes`) для нескольких алгоритмов"""
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
hashes = {i: hashlib.new(i) for i in set(algorithms)}
|
|
369
|
-
ufs = [i.update for i in hashes.values()]
|
|
370
|
-
with self.open_file("rb") as f:
|
|
371
|
-
rf = f.read # read func
|
|
372
|
-
while True:
|
|
373
|
-
b = rf(chunk_size)
|
|
374
|
-
if not b:
|
|
375
|
-
break
|
|
376
|
-
for uf in ufs:
|
|
377
|
-
uf(b)
|
|
378
|
-
return {k: v.digest() for k, v in hashes.items()}
|
|
379
|
-
|
|
380
|
-
def multi_hash_hex(self, algorithms: list[str], **kw) -> dict[str, str]:
|
|
355
|
+
return self.pathlib_path.hash_multi(algorithms, bufsize=chunk_size)
|
|
356
|
+
|
|
357
|
+
def multi_hash_hex(self, algorithms: list[str], **kw):
|
|
381
358
|
"""Хеш файла в HEX строке для нескольких алгоритмов"""
|
|
382
359
|
return {k: v.hex() for k, v in self.multi_hash(algorithms, **kw).items()}
|
|
383
360
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/russian_trusted_root_ca_pem.crt
RENAMED
|
File without changes
|
{mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/api/russian_trusted_sub_ca_pem.crt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/aiohttp_ex/web/__init__.py
RENAMED
|
File without changes
|
{mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/ex/aiohttp_ex/web/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mainshortcuts2-2.8.5 → mainshortcuts2-2.8.7}/src/MainShortcuts2/gui_scripts/ms2_hash_gen.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|