pyquoks 1.2.0__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.0 → pyquoks-1.2.2}/PKG-INFO +2 -1
- {pyquoks-1.2.0 → pyquoks-1.2.2}/README.md +1 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/requirements.txt +1 -1
- {pyquoks-1.2.0 → pyquoks-1.2.2}/setup.cfg +1 -1
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks/data.py +68 -51
- pyquoks-1.2.2/src/pyquoks/localhost.py +19 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks/models.py +4 -4
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks/utils.py +1 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks.egg-info/PKG-INFO +2 -1
- pyquoks-1.2.0/src/pyquoks/localhost.py +0 -15
- {pyquoks-1.2.0 → pyquoks-1.2.2}/LICENSE +0 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/pyproject.toml +0 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks/__init__.py +0 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks.egg-info/SOURCES.txt +0 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks.egg-info/dependency_links.txt +0 -0
- {pyquoks-1.2.0 → pyquoks-1.2.2}/src/pyquoks.egg-info/requires.txt +0 -0
- {pyquoks-1.2.0 → 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
|
|
|
@@ -76,21 +76,21 @@ class IAssetsProvider:
|
|
|
76
76
|
_PATH: str = None
|
|
77
77
|
_NAMES: set[str]
|
|
78
78
|
|
|
79
|
-
def __init__(self, parent: IAssetsProvider):
|
|
79
|
+
def __init__(self, parent: IAssetsProvider) -> None:
|
|
80
80
|
for i in self._NAMES:
|
|
81
81
|
setattr(self, i, parent.file_image(parent._PATH.format(self._PATH.format(i))))
|
|
82
82
|
|
|
83
83
|
class INetwork:
|
|
84
84
|
_URLS: dict[str, str]
|
|
85
85
|
|
|
86
|
-
def __init__(self, parent: IAssetsProvider):
|
|
86
|
+
def __init__(self, parent: IAssetsProvider) -> None:
|
|
87
87
|
for k, v in self._URLS:
|
|
88
88
|
setattr(self, k, parent.network_image(v))
|
|
89
89
|
|
|
90
90
|
_PATH: str
|
|
91
91
|
_ASSETS_OBJECTS: dict[str, type]
|
|
92
92
|
|
|
93
|
-
def __init__(self):
|
|
93
|
+
def __init__(self) -> None:
|
|
94
94
|
for k, v in self._ASSETS_OBJECTS.items():
|
|
95
95
|
setattr(self, k, v(self))
|
|
96
96
|
|
|
@@ -125,69 +125,86 @@ class IStringsProvider:
|
|
|
125
125
|
|
|
126
126
|
_STRINGS_OBJECTS: dict[str, type]
|
|
127
127
|
|
|
128
|
-
def __init__(self):
|
|
128
|
+
def __init__(self) -> None:
|
|
129
129
|
for k, v in self._STRINGS_OBJECTS.items():
|
|
130
130
|
setattr(self, k, v())
|
|
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:
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import waitress, typing, flask
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ILocalhostFlask(flask.Flask):
|
|
6
|
+
_RULES: dict[str, typing.Callable]
|
|
7
|
+
|
|
8
|
+
def __init__(self, import_name: str) -> None:
|
|
9
|
+
super().__init__(import_name)
|
|
10
|
+
|
|
11
|
+
for k, v in self._RULES.items():
|
|
12
|
+
self.add_url_rule(rule=k, view_func=v)
|
|
13
|
+
|
|
14
|
+
def serve(self, port: int) -> None:
|
|
15
|
+
waitress.serve(
|
|
16
|
+
app=self,
|
|
17
|
+
host="127.0.0.1",
|
|
18
|
+
port=port,
|
|
19
|
+
)
|
|
@@ -7,7 +7,7 @@ class IContainer:
|
|
|
7
7
|
_OBJECTS: dict[str, type] = None
|
|
8
8
|
data: dict
|
|
9
9
|
|
|
10
|
-
def __init__(self, json_data: dict):
|
|
10
|
+
def __init__(self, json_data: dict) -> None:
|
|
11
11
|
setattr(self, "data", json_data)
|
|
12
12
|
if isinstance(self._ATTRIBUTES, set):
|
|
13
13
|
for i in self._ATTRIBUTES:
|
|
@@ -31,7 +31,7 @@ class IModel:
|
|
|
31
31
|
_OBJECTS: dict[str, type] = None
|
|
32
32
|
data: dict | list[dict]
|
|
33
33
|
|
|
34
|
-
def __init__(self, json_data: dict | list[dict]):
|
|
34
|
+
def __init__(self, json_data: dict | list[dict]) -> None:
|
|
35
35
|
setattr(self, "data", json_data)
|
|
36
36
|
if isinstance(self._ATTRIBUTES, set):
|
|
37
37
|
for i in self._ATTRIBUTES:
|
|
@@ -55,9 +55,9 @@ class IModel:
|
|
|
55
55
|
class IValues:
|
|
56
56
|
_ATTRIBUTES: set[str] = None
|
|
57
57
|
|
|
58
|
-
def __init__(self, **kwargs):
|
|
58
|
+
def __init__(self, **kwargs) -> None:
|
|
59
59
|
for i in self._ATTRIBUTES:
|
|
60
60
|
setattr(self, i, kwargs.get(i, None))
|
|
61
61
|
|
|
62
|
-
def update(self, **kwargs):
|
|
62
|
+
def update(self, **kwargs) -> None:
|
|
63
63
|
self.__init__(**kwargs)
|
|
@@ -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,15 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
import waitress, flask
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class ILocalhostFlask(flask.Flask):
|
|
6
|
-
_RULES: dict[str, function]
|
|
7
|
-
|
|
8
|
-
def __init__(self):
|
|
9
|
-
super().__init__(import_name="osu!parser")
|
|
10
|
-
|
|
11
|
-
for k, v in self._RULES.items():
|
|
12
|
-
self.add_url_rule(rule=k, view_func=v)
|
|
13
|
-
|
|
14
|
-
def serve(self):
|
|
15
|
-
waitress.serve(app=self, host="127.0.0.1", port=727)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|