MainShortcuts2 2.9.1__tar.gz → 2.9.3__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.9.1 → mainshortcuts2-2.9.3}/PKG-INFO +2 -1
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/pyproject.toml +1 -1
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/_module_info.py +1 -1
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/api/base.py +2 -1
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/dict.py +44 -45
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/pathlib_ex.py +11 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ms2dat1.py +10 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/sql/mysql.py +1 -1
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/sql/postgresql.py +1 -1
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/sql/sqlite.py +1 -1
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/README.md +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/__init__.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/__main__.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/_any2json_regs.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/_ms2app_regs.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/_ms2dat_auto.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/advanced.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/any2json.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/api/gigachat.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/api/github.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/api/russian_trusted_root_ca_pem.crt +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/api/russian_trusted_sub_ca_pem.crt +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/api/webdav.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/cfg.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/core.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/core_config.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/dir.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/__init__.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/aiohttp_ex/web/__init__.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/aiohttp_ex/web/__main__.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/datetime_ex.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/pil_ex.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/psutil_ex.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/sqlite_ex.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/urlparse_ex.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/file.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/gui_scripts/__init__.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/gui_scripts/ms2_hash_gen.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/gui_scripts/utils.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/java_ext/__init__.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/java_ext/ms2ext.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/json.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/linux.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/list.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ms2app.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ms2dat1crypto.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ms2hash.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/path.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/proc.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/regex.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/special_chars.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/sql/_sql_base.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/str.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/term.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/types.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/utils.py +0 -0
- {mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/win.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MainShortcuts2
|
|
3
|
-
Version: 2.9.
|
|
3
|
+
Version: 2.9.3
|
|
4
4
|
Summary: Сокращение и улучшение функций + консольные утилиты
|
|
5
5
|
Author: MainPlay TG
|
|
6
6
|
Author-email: xbox.roman6666666666@gmail.com
|
|
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
14
15
|
Provides-Extra: crypto
|
|
15
16
|
Provides-Extra: full
|
|
16
17
|
Provides-Extra: http
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
name = 'mainshortcuts2'
|
|
2
|
-
version = '2.9.
|
|
2
|
+
version = '2.9.3'
|
|
@@ -35,11 +35,12 @@ class BaseClient(ms.ObjectBase):
|
|
|
35
35
|
self._init(**kw)
|
|
36
36
|
|
|
37
37
|
def _init(self, session: requests.Session = None):
|
|
38
|
-
self.__dict__["http"] = session
|
|
39
38
|
setdefattr(self, "_enable_cookies", False)
|
|
40
39
|
setdefattr(self, "_url_data", {})
|
|
41
40
|
setdefattr(self, "_url", "https://example.com/api/{method}")
|
|
42
41
|
setdefattr(self, "cache", CacheStorage())
|
|
42
|
+
if session:
|
|
43
|
+
self.__dict__["http"] = session
|
|
43
44
|
|
|
44
45
|
def __enter__(self):
|
|
45
46
|
return self
|
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
"""Работа со словарями"""
|
|
2
|
-
from .core import ms
|
|
3
|
-
from typing import *
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
keys =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return r
|
|
1
|
+
"""Работа со словарями"""
|
|
2
|
+
from .core import ms
|
|
3
|
+
from typing import *
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def merge(old: dict, new: dict) -> dict:
|
|
7
|
+
"""Рекурсиво объединить словари"""
|
|
8
|
+
out = old.copy()
|
|
9
|
+
for k, v in new.items():
|
|
10
|
+
if k in out:
|
|
11
|
+
if isinstance(out[k], dict) and isinstance(v, dict):
|
|
12
|
+
out[k] = merge(out[k], v)
|
|
13
|
+
else:
|
|
14
|
+
out[k] = v
|
|
15
|
+
else:
|
|
16
|
+
out[k] = v
|
|
17
|
+
return out
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def reverse(d: dict) -> dict:
|
|
21
|
+
"""Развернуть порядок ключей"""
|
|
22
|
+
keys = list(d.keys())[::-1]
|
|
23
|
+
r = {}
|
|
24
|
+
for k in keys:
|
|
25
|
+
r[k] = d[k]
|
|
26
|
+
return r
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def sort(d: dict, *, key=None, reverse: bool = False) -> dict:
|
|
30
|
+
"""Сортировать порядок ключей"""
|
|
31
|
+
keys = list(d.keys())
|
|
32
|
+
keys.sort(key=key, reverse=reverse)
|
|
33
|
+
r = {}
|
|
34
|
+
for k in keys:
|
|
35
|
+
r[k] = d[k]
|
|
36
|
+
return r
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def swap(d: dict) -> dict:
|
|
40
|
+
"""Вывернуть словарь (повторяющиеся значения будут перезаписаны)"""
|
|
41
|
+
r = {}
|
|
42
|
+
for k, v in d.items():
|
|
43
|
+
r[v] = k
|
|
44
|
+
return r
|
|
@@ -266,3 +266,14 @@ class Path(pathlib.Path):
|
|
|
266
266
|
raise FileExistsError(dest)
|
|
267
267
|
hash = ms2hash.HashInfo.from_file(alg, self, **kw)
|
|
268
268
|
return dest.write_bytes(hash.to_auto(v))
|
|
269
|
+
|
|
270
|
+
def write_bytes_direct(self, data: bytes, **kw):
|
|
271
|
+
"""Записать байты в файл без атомарной перезаписи"""
|
|
272
|
+
with self.open("wb", **kw) as f:
|
|
273
|
+
return f.write(data)
|
|
274
|
+
|
|
275
|
+
def write_text_direct(self, data: str, **kw):
|
|
276
|
+
"""Записать текст в файл без атомарной перезаписи"""
|
|
277
|
+
kw.setdefault("encoding", "utf-8")
|
|
278
|
+
with self.open("w", **kw) as f:
|
|
279
|
+
return f.write(data)
|
|
@@ -548,6 +548,16 @@ class MS2Dat1EncryptExample(MS2Dat1):
|
|
|
548
548
|
|
|
549
549
|
inst = MS2Dat1()
|
|
550
550
|
"""Настройки по умолчанию"""
|
|
551
|
+
inst_compressed = MS2Dat1()
|
|
552
|
+
"""Лучшее сжатие"""
|
|
553
|
+
inst_compressed.set_compress(MS2Dat1.COMPRESS_LZMA)
|
|
554
|
+
inst_compressed.set_hash(MS2Dat1.HASH_SHA3_256)
|
|
555
|
+
inst_compressed.set_use_dict(True)
|
|
556
|
+
inst_fastest = MS2Dat1()
|
|
557
|
+
"""Лучшая скорость"""
|
|
558
|
+
inst_fastest.set_compress(MS2Dat1.COMPRESS_NONE)
|
|
559
|
+
inst_fastest.set_hash(MS2Dat1.HASH_NONE)
|
|
560
|
+
inst_fastest.set_use_dict(False)
|
|
551
561
|
dump = inst.dump
|
|
552
562
|
dumps = inst.dumps
|
|
553
563
|
load = inst.load
|
|
@@ -32,7 +32,7 @@ class Database(SyncDatabaseBase):
|
|
|
32
32
|
self.db_path = Path(path)
|
|
33
33
|
self.db_path.parent.any_mkdir()
|
|
34
34
|
self.strict_schema = strict_schema
|
|
35
|
-
|
|
35
|
+
super().__init__(**kw)
|
|
36
36
|
if TYPE_CHECKING:
|
|
37
37
|
def cursor(self) -> Cursor:
|
|
38
38
|
return super().cursor()
|
|
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.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/api/russian_trusted_root_ca_pem.crt
RENAMED
|
File without changes
|
{mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/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
|
{mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/src/MainShortcuts2/ex/aiohttp_ex/web/__init__.py
RENAMED
|
File without changes
|
{mainshortcuts2-2.9.1 → mainshortcuts2-2.9.3}/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.9.1 → mainshortcuts2-2.9.3}/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
|