advdbg 0.3.1__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: advdbg
3
- Version: 0.3.1
3
+ Version: 0.3.3
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,9 @@ dbgVar.cfg(title='REQUEST')
48
48
  BEFORE: title of your debug
49
49
  AFTER: REQUEST
50
50
 
51
- ## Change Log: v0.3.1
51
+ ## Change Log: v0.3.3
52
52
 
53
- - Hotfix of 0.3.0
53
+ - Hotfix of 0.3.2
54
54
 
55
55
  ## Requirements
56
56
 
@@ -33,9 +33,9 @@ dbgVar.cfg(title='REQUEST')
33
33
  BEFORE: title of your debug
34
34
  AFTER: REQUEST
35
35
 
36
- ## Change Log: v0.3.1
36
+ ## Change Log: v0.3.3
37
37
 
38
- - Hotfix of 0.3.0
38
+ - Hotfix of 0.3.2
39
39
 
40
40
  ## Requirements
41
41
 
@@ -2,13 +2,13 @@
2
2
  Welcome to Advanced Debug.
3
3
  Licensed with MIT
4
4
 
5
+ So big update.
6
+
5
7
  Change Logs:
6
- - Added .about()
7
- - Added custom exception
8
- - Added checker for updates
8
+ - Hot-fix 0.3.2
9
9
  '''
10
10
 
11
- __version__ = '0.2.9'
11
+ __version__ = '0.3.3'
12
12
 
13
13
  from .core import AdvDBG
14
14
 
@@ -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 = ['Writting some lines.', "Don't forgot to define!", 'Waiting for your command.']
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}"')
@@ -0,0 +1,27 @@
1
+ """
2
+
3
+ Advanced Debugger
4
+ Exception list
5
+
6
+ """
7
+
8
+
9
+
10
+ class OutputListError(Exception):
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
+
27
+ pass
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: advdbg
3
- Version: 0.3.1
3
+ Version: 0.3.3
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,9 @@ dbgVar.cfg(title='REQUEST')
48
48
  BEFORE: title of your debug
49
49
  AFTER: REQUEST
50
50
 
51
- ## Change Log: v0.3.1
51
+ ## Change Log: v0.3.3
52
52
 
53
- - Hotfix of 0.3.0
53
+ - Hotfix of 0.3.2
54
54
 
55
55
  ## Requirements
56
56
 
@@ -6,6 +6,7 @@ advdbg/analyze.py
6
6
  advdbg/colors.py
7
7
  advdbg/core.py
8
8
  advdbg/exceptions.py
9
+ advdbg/telegram.py
9
10
  advdbg/update.py
10
11
  advdbg.egg-info/PKG-INFO
11
12
  advdbg.egg-info/SOURCES.txt
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "advdbg"
7
- version = "0.3.1"
7
+ version = "0.3.3"
8
8
  authors = [
9
9
  {name = "Darkey", email = "weplayok3@gmail.com"}, {name = "WinFun", email = "placeholder@gmail.com"}
10
10
  ]
@@ -1,13 +0,0 @@
1
- """
2
-
3
- Advanced Debugger
4
- Exception list
5
-
6
- """
7
-
8
-
9
-
10
- class OutputListError(Exception):
11
- """Raised when detected error
12
- in list"""
13
- pass
File without changes
File without changes
File without changes
File without changes
File without changes