pyquoks 1.2.1__tar.gz → 1.2.2__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.
- {pyquoks-1.2.1 → pyquoks-1.2.2}/PKG-INFO +2 -1
- {pyquoks-1.2.1 → pyquoks-1.2.2}/README.md +1 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/requirements.txt +1 -1
- {pyquoks-1.2.1 → pyquoks-1.2.2}/setup.cfg +1 -1
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks/data.py +64 -47
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks/localhost.py +2 -2
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks/utils.py +1 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks.egg-info/PKG-INFO +2 -1
- {pyquoks-1.2.1 → pyquoks-1.2.2}/LICENSE +0 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/pyproject.toml +0 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks/__init__.py +0 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks/models.py +0 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks.egg-info/SOURCES.txt +0 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks.egg-info/dependency_links.txt +0 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks.egg-info/requires.txt +0 -0
- {pyquoks-1.2.1 → pyquoks-1.2.2}/src/pyquoks.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyquoks
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Пакет PyPI для часто используемых модулей в проектах diquoks
|
|
5
5
|
Home-page: https://diquoks.ru
|
|
6
6
|
Author: Denis Titovets
|
|
@@ -46,6 +46,7 @@ Dynamic: license-file
|
|
|
46
46
|
|
|
47
47
|
#### Связь с разработчиком
|
|
48
48
|
|
|
49
|
+
- [План разработки pyquoks](https://www.icloud.com/notes/0e0C-Bm4IkqXuBYqJrq00yhog)
|
|
49
50
|
- [Telegram для связи](https://t.me/diquoks)
|
|
50
51
|
- [Почта для связи](mailto:diquoks@yandex.ru)
|
|
51
52
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
import configparser, datetime, logging,
|
|
2
|
+
import configparser, datetime, logging, json, sys, io, os
|
|
3
3
|
import requests, PIL.Image, PIL.ImageDraw
|
|
4
4
|
from . import utils
|
|
5
5
|
|
|
@@ -131,63 +131,80 @@ class IStringsProvider:
|
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
# Managers
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
134
|
+
if sys.platform == "win32":
|
|
135
|
+
import winreg
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class IRegistryManager:
|
|
139
|
+
class IRegistry:
|
|
140
|
+
_NAME: str = None
|
|
141
|
+
_REGISTRY_VALUES: dict[str, int]
|
|
142
|
+
|
|
143
|
+
def __init__(self, parent: IRegistryManager = None) -> None:
|
|
144
|
+
if isinstance(parent, IRegistryManager):
|
|
145
|
+
self._REGISTRY_VALUES = parent._REGISTRY_VALUES.get(self._NAME)
|
|
146
|
+
self._path = winreg.CreateKey(parent._path, self._NAME)
|
|
147
|
+
for i in self._REGISTRY_VALUES.keys():
|
|
148
|
+
try:
|
|
149
|
+
setattr(self, i, winreg.QueryValueEx(self._path, i)[int()])
|
|
150
|
+
except:
|
|
151
|
+
setattr(self, i, None)
|
|
152
|
+
|
|
153
|
+
@property
|
|
154
|
+
def values(self) -> dict | None:
|
|
155
|
+
try:
|
|
156
|
+
return {i: getattr(self, i) for i in self._REGISTRY_VALUES}
|
|
157
|
+
except:
|
|
158
|
+
return None
|
|
159
|
+
|
|
160
|
+
def refresh(self) -> IRegistryManager.IRegistry:
|
|
161
|
+
self.__init__()
|
|
162
|
+
return self
|
|
163
|
+
|
|
164
|
+
def update(self, **kwargs) -> None:
|
|
165
|
+
for k, v in kwargs.items():
|
|
166
|
+
winreg.SetValueEx(self._path, k, None, self._REGISTRY_VALUES.get(k), v)
|
|
167
|
+
setattr(self, k, v)
|
|
168
|
+
|
|
169
|
+
_KEY: str
|
|
170
|
+
_REGISTRY_VALUES: dict[str, dict[str, int]]
|
|
171
|
+
_REGISTRY_OBJECTS: dict[str, type]
|
|
172
|
+
_path: winreg.HKEYType
|
|
173
|
+
|
|
174
|
+
def __init__(self) -> None:
|
|
175
|
+
self._path = winreg.CreateKey(winreg.HKEY_CURRENT_USER, self._KEY)
|
|
176
|
+
for k, v in self._REGISTRY_OBJECTS.items():
|
|
177
|
+
setattr(self, k, v(self))
|
|
178
|
+
|
|
179
|
+
def refresh(self) -> IRegistryManager:
|
|
157
180
|
self.__init__()
|
|
158
181
|
return self
|
|
159
182
|
|
|
160
|
-
def update(self, **kwargs) -> None:
|
|
161
|
-
for k, v in kwargs.items():
|
|
162
|
-
winreg.SetValueEx(self._path, k, None, self._REGISTRY_VALUES.get(k), v)
|
|
163
|
-
setattr(self, k, v)
|
|
164
|
-
|
|
165
|
-
_KEY: str
|
|
166
|
-
_REGISTRY_VALUES: dict[str, dict[str, int]]
|
|
167
|
-
_REGISTRY_OBJECTS: dict[str, type]
|
|
168
|
-
_path: winreg.HKEYType
|
|
169
|
-
|
|
170
|
-
def __init__(self) -> None:
|
|
171
|
-
self._path = winreg.CreateKey(winreg.HKEY_CURRENT_USER, self._KEY)
|
|
172
|
-
for k, v in self._REGISTRY_OBJECTS.items():
|
|
173
|
-
setattr(self, k, v(self))
|
|
174
|
-
|
|
175
|
-
def refresh(self) -> IRegistryManager:
|
|
176
|
-
self.__init__()
|
|
177
|
-
return self
|
|
178
|
-
|
|
179
183
|
|
|
180
184
|
# Services
|
|
181
185
|
class LoggerService(logging.Logger):
|
|
182
|
-
def __init__(
|
|
186
|
+
def __init__(
|
|
187
|
+
self,
|
|
188
|
+
name: str, file_handling: bool = True,
|
|
189
|
+
filename: str = datetime.datetime.now().strftime("%d-%m-%y-%H-%M-%S"),
|
|
190
|
+
level: int = logging.NOTSET,
|
|
191
|
+
folder_name: str = "logs",
|
|
192
|
+
) -> None:
|
|
183
193
|
super().__init__(name, level)
|
|
184
194
|
stream_handler = logging.StreamHandler(sys.stdout)
|
|
185
|
-
stream_handler.setFormatter(
|
|
195
|
+
stream_handler.setFormatter(
|
|
196
|
+
logging.Formatter(fmt="$levelname $asctime $name - $message", datefmt="%d-%m-%y %H:%M:%S", style="$")
|
|
197
|
+
)
|
|
186
198
|
self.addHandler(stream_handler)
|
|
187
199
|
if file_handling:
|
|
188
200
|
os.makedirs(utils.get_path(folder_name, only_abspath=True), exist_ok=True)
|
|
189
|
-
file_handler = logging.FileHandler(
|
|
190
|
-
|
|
201
|
+
file_handler = logging.FileHandler(
|
|
202
|
+
utils.get_path(f"{folder_name}/{filename}-{name}.log", only_abspath=True),
|
|
203
|
+
encoding="utf-8",
|
|
204
|
+
)
|
|
205
|
+
file_handler.setFormatter(
|
|
206
|
+
logging.Formatter(fmt="$levelname $asctime - $message", datefmt="%d-%m-%y %H:%M:%S", style="$"),
|
|
207
|
+
)
|
|
191
208
|
self.addHandler(file_handler)
|
|
192
209
|
|
|
193
210
|
def log_exception(self, e: Exception) -> None:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
import waitress, flask
|
|
2
|
+
import waitress, typing, flask
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class ILocalhostFlask(flask.Flask):
|
|
6
|
-
_RULES: dict[str,
|
|
6
|
+
_RULES: dict[str, typing.Callable]
|
|
7
7
|
|
|
8
8
|
def __init__(self, import_name: str) -> None:
|
|
9
9
|
super().__init__(import_name)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyquoks
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Пакет PyPI для часто используемых модулей в проектах diquoks
|
|
5
5
|
Home-page: https://diquoks.ru
|
|
6
6
|
Author: Denis Titovets
|
|
@@ -46,6 +46,7 @@ Dynamic: license-file
|
|
|
46
46
|
|
|
47
47
|
#### Связь с разработчиком
|
|
48
48
|
|
|
49
|
+
- [План разработки pyquoks](https://www.icloud.com/notes/0e0C-Bm4IkqXuBYqJrq00yhog)
|
|
49
50
|
- [Telegram для связи](https://t.me/diquoks)
|
|
50
51
|
- [Почта для связи](mailto:diquoks@yandex.ru)
|
|
51
52
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|