advdbg 0.3.1__py3-none-any.whl → 0.3.2__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.
- advdbg/__init__.py +5 -4
- advdbg/core.py +52 -2
- advdbg/exceptions.py +16 -2
- advdbg/telegram.py +0 -0
- {advdbg-0.3.1.dist-info → advdbg-0.3.2.dist-info}/METADATA +4 -3
- advdbg-0.3.2.dist-info/RECORD +12 -0
- {advdbg-0.3.1.dist-info → advdbg-0.3.2.dist-info}/WHEEL +1 -1
- advdbg-0.3.1.dist-info/RECORD +0 -11
- {advdbg-0.3.1.dist-info → advdbg-0.3.2.dist-info}/licenses/LICENSE +0 -0
- {advdbg-0.3.1.dist-info → advdbg-0.3.2.dist-info}/top_level.txt +0 -0
advdbg/__init__.py
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Welcome to Advanced Debug.
|
|
3
3
|
Licensed with MIT
|
|
4
4
|
|
|
5
|
+
So big update.
|
|
6
|
+
|
|
5
7
|
Change Logs:
|
|
6
|
-
-
|
|
7
|
-
- Added
|
|
8
|
-
- Added checker for updates
|
|
8
|
+
- Fixed "AdvDBG" class __init
|
|
9
|
+
- Added Tags
|
|
9
10
|
'''
|
|
10
11
|
|
|
11
|
-
__version__ = '0.2
|
|
12
|
+
__version__ = '0.3.2'
|
|
12
13
|
|
|
13
14
|
from .core import AdvDBG
|
|
14
15
|
|
advdbg/core.py
CHANGED
|
@@ -8,6 +8,9 @@ from datetime import datetime
|
|
|
8
8
|
import random
|
|
9
9
|
from typing import Dict, Any, Optional, List
|
|
10
10
|
import requests
|
|
11
|
+
import json
|
|
12
|
+
import sys
|
|
13
|
+
|
|
11
14
|
|
|
12
15
|
from .update import Update
|
|
13
16
|
from .colors import Colors
|
|
@@ -18,10 +21,12 @@ from .exceptions import OutputListError
|
|
|
18
21
|
# INFO = ""
|
|
19
22
|
# SUCCESS = ""
|
|
20
23
|
|
|
21
|
-
listPhrases = ['
|
|
24
|
+
listPhrases = ['Writing some lines.', "Don't forgot to define!", 'Waiting for your command.']
|
|
22
25
|
randomPhrase = random.choice(listPhrases)
|
|
23
26
|
|
|
24
27
|
class AdvDBG:
|
|
28
|
+
DEFAULT_CONFIG_FILE = 'data.adv'
|
|
29
|
+
|
|
25
30
|
_category_store: Dict[str, Dict[str, Any]] = {}
|
|
26
31
|
_defined_categories: Dict[str, 'AdvDBG'] = {}
|
|
27
32
|
|
|
@@ -122,6 +127,25 @@ class AdvDBG:
|
|
|
122
127
|
cls._defined_categories[title] = inst
|
|
123
128
|
return inst
|
|
124
129
|
|
|
130
|
+
@staticmethod
|
|
131
|
+
def _process_item(item):
|
|
132
|
+
item_type = item.get('type', 'info')
|
|
133
|
+
item_id = item.get('id', 'N/A')
|
|
134
|
+
msg = item.get('message', 'No Text')
|
|
135
|
+
title = item.get('title', 'No Title')
|
|
136
|
+
|
|
137
|
+
dbg = AdvDBG.define(title)
|
|
138
|
+
|
|
139
|
+
if item_type == 'info':
|
|
140
|
+
dbg.info(message)
|
|
141
|
+
elif item_type == 'success':
|
|
142
|
+
dbg.success(message)
|
|
143
|
+
elif item_type == 'warn':
|
|
144
|
+
dbg.warn(message)
|
|
145
|
+
elif item_type == 'error':
|
|
146
|
+
dbg.error(message)
|
|
147
|
+
|
|
148
|
+
|
|
125
149
|
@classmethod
|
|
126
150
|
def get_category_settings(cls, category: str) -> Optional[Dict[str, Any]]:
|
|
127
151
|
if category in cls._category_store:
|
|
@@ -289,4 +313,30 @@ class AdvDBG:
|
|
|
289
313
|
text = str(text)
|
|
290
314
|
except Exception as e:
|
|
291
315
|
text = f"Cannot convert to string format: {e}"
|
|
292
|
-
self.info(text)
|
|
316
|
+
self.info(text)
|
|
317
|
+
|
|
318
|
+
def jsontoline(id: int, file: str):
|
|
319
|
+
"""
|
|
320
|
+
Handling .adv file and logs needed ID.
|
|
321
|
+
"""
|
|
322
|
+
if not os.path.exists(file):
|
|
323
|
+
raise FileNotFoundError(f"No such file or directory: '{file}'")
|
|
324
|
+
|
|
325
|
+
with open(file, 'r', encoding='utf-8') as f:
|
|
326
|
+
data = json.load(f)
|
|
327
|
+
sys_msg = AdvDBG.define('AdvDBG - System')
|
|
328
|
+
|
|
329
|
+
if not isinstance(data, list):
|
|
330
|
+
sys_msg.error('Excepted list of objects (Array JSON).')
|
|
331
|
+
return
|
|
332
|
+
|
|
333
|
+
found_item = None
|
|
334
|
+
for item in data:
|
|
335
|
+
if item.get('id') == id:
|
|
336
|
+
found_item = item
|
|
337
|
+
break
|
|
338
|
+
|
|
339
|
+
if found_item:
|
|
340
|
+
_process_item(found_item)
|
|
341
|
+
else:
|
|
342
|
+
sys_msg.error(f'Line with ID {id} not found in file "{file}"')
|
advdbg/exceptions.py
CHANGED
|
@@ -8,6 +8,20 @@ Exception list
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class OutputListError(Exception):
|
|
11
|
-
"""
|
|
12
|
-
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
Raised when detected error
|
|
14
|
+
in list
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
class TelegramAuthException(Exception):
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
Raised when API Telegram returns "Unauthorized" error
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
|
|
13
27
|
pass
|
advdbg/telegram.py
ADDED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: advdbg
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Minimalist colorful debug logger
|
|
5
5
|
Author-email: Darkey <weplayok3@gmail.com>, WinFun <placeholder@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -48,9 +48,10 @@ dbgVar.cfg(title='REQUEST')
|
|
|
48
48
|
BEFORE: title of your debug
|
|
49
49
|
AFTER: REQUEST
|
|
50
50
|
|
|
51
|
-
## Change Log: v0.3.
|
|
51
|
+
## Change Log: v0.3.2
|
|
52
52
|
|
|
53
|
-
- Hotfix of 0.3.
|
|
53
|
+
- Hotfix of 0.3.1
|
|
54
|
+
- Added "Json to Line"
|
|
54
55
|
|
|
55
56
|
## Requirements
|
|
56
57
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
advdbg/__init__.py,sha256=DUgIl21p-NJIBuawpOlDz-lL5vlLiUAkUz2FezXOlCo,557
|
|
2
|
+
advdbg/analyze.py,sha256=eQ4aOBhTm1CUSbOjixzF-01yXSKH8eGP-AlOk4bfYYA,1562
|
|
3
|
+
advdbg/colors.py,sha256=VupEvIYoKgq2aqyApkPRN8HbIKr1DMNaIqj-2-DiZr0,223
|
|
4
|
+
advdbg/core.py,sha256=uSieS-5cISCt-dkT63cSN1H_nARwgUr25DUzoyBRgRc,13804
|
|
5
|
+
advdbg/exceptions.py,sha256=lNEJ6ZhzqOj-LF09g74sUPetReRvAIAI3J9p8ocR8hY,306
|
|
6
|
+
advdbg/telegram.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
advdbg/update.py,sha256=rziY_UmgTgQYbnVgvQP-fYxJerIWFdqQqAHiLHdJft4,800
|
|
8
|
+
advdbg-0.3.2.dist-info/licenses/LICENSE,sha256=tgtiy7agRoAxbOt3NAJk_KmNWkhC1Pr4oDQAjXaEhWw,1062
|
|
9
|
+
advdbg-0.3.2.dist-info/METADATA,sha256=aXoQbM8vFlhOGGj2KG9_p8JrmEU8Ig_mkhC9wTxAHso,1314
|
|
10
|
+
advdbg-0.3.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
11
|
+
advdbg-0.3.2.dist-info/top_level.txt,sha256=oK_Jw0888nhPCLjrEGxdnJ5-5TaNjWeGbyEmjov62b0,7
|
|
12
|
+
advdbg-0.3.2.dist-info/RECORD,,
|
advdbg-0.3.1.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
advdbg/__init__.py,sha256=l3cB2PY6LwThrCY48lgsJBFes3ChvyR-g_lnoMVA2Zs,569
|
|
2
|
-
advdbg/analyze.py,sha256=eQ4aOBhTm1CUSbOjixzF-01yXSKH8eGP-AlOk4bfYYA,1562
|
|
3
|
-
advdbg/colors.py,sha256=VupEvIYoKgq2aqyApkPRN8HbIKr1DMNaIqj-2-DiZr0,223
|
|
4
|
-
advdbg/core.py,sha256=NrVymay8M9H38ci5L4Kp1eZ8sf9bF-ogiuKAMomhYH0,12279
|
|
5
|
-
advdbg/exceptions.py,sha256=-6ocxNNAdH9bZVT2qlxYm-HiHwvQGNe5DRMLC-hAdCw,137
|
|
6
|
-
advdbg/update.py,sha256=rziY_UmgTgQYbnVgvQP-fYxJerIWFdqQqAHiLHdJft4,800
|
|
7
|
-
advdbg-0.3.1.dist-info/licenses/LICENSE,sha256=tgtiy7agRoAxbOt3NAJk_KmNWkhC1Pr4oDQAjXaEhWw,1062
|
|
8
|
-
advdbg-0.3.1.dist-info/METADATA,sha256=ysn603S49_UDHJuo9g4cvWoXqFyHRNF6j0JHhDSvgtc,1291
|
|
9
|
-
advdbg-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
advdbg-0.3.1.dist-info/top_level.txt,sha256=oK_Jw0888nhPCLjrEGxdnJ5-5TaNjWeGbyEmjov62b0,7
|
|
11
|
-
advdbg-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|