toolfor-debug 0.1.0__tar.gz → 0.2.0.0__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
- Name: toolfor-debug
3
- Version: 0.1.0
2
+ Name: toolfor_debug
3
+ Version: 0.2.0.0
4
4
  Summary: Debug Module
5
5
  Author-email: ZedKa450 <zedka.le.vrai.pro@gmail.com>
6
6
  License: GPL-3.0-only
@@ -22,7 +22,7 @@ A lightweight Python debugging utility. This module allows you to manage print s
22
22
  ## Installation
23
23
 
24
24
  `
25
- pip install module `
25
+ pip install toolfor_debug `
26
26
 
27
27
  ## Usage
28
28
 
@@ -38,7 +38,7 @@ i: Input only
38
38
 
39
39
  Example:
40
40
  `
41
- from debug import State, Tools
41
+ from toolfor_debug import State, Tools
42
42
  State.active_debug("p+") `
43
43
 
44
44
  2. ### Using Tools
@@ -54,7 +54,7 @@ Tools.dclear() `
54
54
  3. ### Check State
55
55
  Example:
56
56
  `
57
- status = State.parameters()
57
+ status = State.view("settings")
58
58
  print(f"Current System State: {status}") `
59
59
 
60
60
  ## Authors
@@ -11,7 +11,7 @@ A lightweight Python debugging utility. This module allows you to manage print s
11
11
  ## Installation
12
12
 
13
13
  `
14
- pip install module `
14
+ pip install toolfor_debug `
15
15
 
16
16
  ## Usage
17
17
 
@@ -27,7 +27,7 @@ i: Input only
27
27
 
28
28
  Example:
29
29
  `
30
- from debug import State, Tools
30
+ from toolfor_debug import State, Tools
31
31
  State.active_debug("p+") `
32
32
 
33
33
  2. ### Using Tools
@@ -43,7 +43,7 @@ Tools.dclear() `
43
43
  3. ### Check State
44
44
  Example:
45
45
  `
46
- status = State.parameters()
46
+ status = State.view("settings")
47
47
  print(f"Current System State: {status}") `
48
48
 
49
49
  ## Authors
@@ -3,8 +3,8 @@ requires = ["setuptools", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
- name = "toolfor-debug"
7
- version = "0.1.0"
6
+ name = "toolfor_debug"
7
+ version = "0.2.0.0"
8
8
  description = "Debug Module"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -0,0 +1,135 @@
1
+ import os, time
2
+
3
+ debug_mode = None
4
+ output_file = None
5
+
6
+ class State:
7
+ @staticmethod
8
+ def active_debug(MODE="p+", OUTPUT="pythonconsole"):
9
+ if MODE == "p+":
10
+ global debug_mode, output_file
11
+ debug_mode = "p+"
12
+ output_file = OUTPUT
13
+ elif MODE == "p":
14
+ global debug_mode, output_file
15
+ debug_mode = "p"
16
+ output_file = OUTPUT
17
+ elif MODE == "i":
18
+ global debug_mode, output_file
19
+ debug_mode = "i"
20
+ output_file = OUTPUT
21
+
22
+ @staticmethod
23
+ def desactive_debug():
24
+ global debug_mode, output_file
25
+ debug_mode = None
26
+ output_file = None
27
+
28
+ @staticmethod
29
+ def view(what):
30
+ global debug_mode, output_file
31
+ if what == "settings":
32
+ if not debug_mode == None and not output_file == None:
33
+ return "Activated", debug_mode, output_file
34
+ else:
35
+ return "Desactivated"
36
+ elif what == "mode":
37
+ if not debug_mode == None:
38
+ return debug_mode
39
+ else:
40
+ return "Debug mode is desactivated"
41
+ elif what == "output_file":
42
+ if not output_file == None:
43
+ return output_file
44
+ else:
45
+ return "Output file is not set or debug mode is desactivated"
46
+ elif what == "output_text":
47
+ if not debug_mode == None and not output_file == None:
48
+ if output_file == "pythonconsole":
49
+ return "Output is set to python console, no output text to show"
50
+ elif output_file == "automatic":
51
+ script_dir = os.path.dirname(os.path.abspath(__file__))
52
+ file_path = os.path.join(script_dir, "debug_output.txt")
53
+ if os.path.exists(file_path):
54
+ with open(file_path, "r") as f:
55
+ return f.read()
56
+ else:
57
+ return "No debug output found"
58
+ else:
59
+ if os.path.exists(output_file):
60
+ with open(output_file, "r") as f:
61
+ return f.read()
62
+ else:
63
+ return "Output file doesn't exists, please create it or use pythonconsole or automatic as output"
64
+ else:
65
+ return "Debug mode is desactivated or output file is not set, no output text to show"
66
+
67
+ @staticmethod
68
+ def change_settings(MODE=None, OUTPUT=None):
69
+ global debug_mode, output_file
70
+ if MODE != None:
71
+ if MODE == "p+" or MODE == "p" or MODE == "i":
72
+ debug_mode = MODE
73
+ else:
74
+ print("Invalid mode, please choose between p+, p or i")
75
+ if OUTPUT != None:
76
+ output_file = OUTPUT
77
+
78
+ class Tools:
79
+ @staticmethod
80
+ def dprint(*args, **kwargs):
81
+ global debug_mode, output_file
82
+ if debug_mode == "p+" or debug_mode == "p" and output_file != None:
83
+ if output_file == "pythonconsole":
84
+ print("DEBUG: ", *args, **kwargs)
85
+
86
+ elif output_file == "automatic":
87
+ script_dir = os.path.dirname(os.path.abspath(__file__))
88
+ file_path = os.path.join(script_dir, "debug_output.txt")
89
+
90
+ with open(file_path, "a") as f:
91
+ print("DEBUG: ", *args, **kwargs, file=f)
92
+ else:
93
+ with open(output_file, "a") as f:
94
+ if os.path.exists(output_file):
95
+ print("DEBUG: ", *args, **kwargs, file=f)
96
+ else:
97
+ print("Output file doesn't exists, please create it or use pythonconsole or automatic as output")
98
+ else:
99
+ print("Debug mode is not active or output file is not set for dprint")
100
+
101
+ @staticmethod
102
+ def dinput(*args):
103
+ global debug_mode, output_file
104
+ if debug_mode == "p+" or debug_mode == "i" and output_file != None:
105
+ if output_file == "pythonconsole":
106
+ return input("DEBUG: ", *args)
107
+ else:
108
+ print("Dinput do not support output by file, use pythonconsole as output to use dinput")
109
+ return None
110
+ else:
111
+ print("Debug mode is not active or output file is not set for dinput")
112
+ return None
113
+
114
+ @staticmethod
115
+ def dclear():
116
+ global debug_mode
117
+ if debug_mode and output_file != None:
118
+ if output_file == "pythonconsole":
119
+ os.system('cls' if os.name == 'nt' else 'clear')
120
+ else:
121
+ print("Dclear do not support output by file, use pythonconsole as output to use dclear")
122
+ else:
123
+ print("Debug mode is not active or output file is not set for dclear")
124
+
125
+ @staticmethod
126
+ def dwait(seconds):
127
+ global debug_mode
128
+ if debug_mode and output_file != None:
129
+ if output_file == "pythonconsole":
130
+ time.sleep(seconds)
131
+ else:
132
+ print("Dwait do not support output by file, use pythonconsole as output to use dwait")
133
+ else:
134
+ print("Debug mode is not active or output file is not set for dwait")
135
+
@@ -0,0 +1,24 @@
1
+ import os
2
+ import importlib
3
+ import sys
4
+
5
+ class State:
6
+ @staticmethod
7
+ def UpdateModule(mode="pip"):
8
+ if mode == "pip":
9
+ os.system(f"{sys.executable} -m pip install --upgrade toolfor_debug")
10
+ elif mode == "uv":
11
+ os.system(f"{sys.executable} -m uv pip install --upgrade toolfor_debug")
12
+ elif mode == "poetry":
13
+ os.system("poetry add toolfor_debug@latest")
14
+ elif mode == "conda":
15
+ os.system(f"{sys.executable} -m conda install -c conda-forge toolfor_debug")
16
+ elif mode == "git":
17
+ if not os.path.exists("toolfor_debug"):
18
+ os.system("git clone https://github.com/zedka450/toolfor_debug.git")
19
+ else:
20
+ os.system("cd toolfor_debug && git pull")
21
+
22
+ import toolfor_debug
23
+ importlib.reload(toolfor_debug)
24
+ return toolfor_debug
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
- Name: toolfor-debug
3
- Version: 0.1.0
2
+ Name: toolfor_debug
3
+ Version: 0.2.0.0
4
4
  Summary: Debug Module
5
5
  Author-email: ZedKa450 <zedka.le.vrai.pro@gmail.com>
6
6
  License: GPL-3.0-only
@@ -22,7 +22,7 @@ A lightweight Python debugging utility. This module allows you to manage print s
22
22
  ## Installation
23
23
 
24
24
  `
25
- pip install module `
25
+ pip install toolfor_debug `
26
26
 
27
27
  ## Usage
28
28
 
@@ -38,7 +38,7 @@ i: Input only
38
38
 
39
39
  Example:
40
40
  `
41
- from debug import State, Tools
41
+ from toolfor_debug import State, Tools
42
42
  State.active_debug("p+") `
43
43
 
44
44
  2. ### Using Tools
@@ -54,7 +54,7 @@ Tools.dclear() `
54
54
  3. ### Check State
55
55
  Example:
56
56
  `
57
- status = State.parameters()
57
+ status = State.view("settings")
58
58
  print(f"Current System State: {status}") `
59
59
 
60
60
  ## Authors
@@ -1,6 +1,8 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
+ toolfor_debug/__init__.py
5
+ toolfor_debug/__update__.py
4
6
  toolfor_debug.egg-info/PKG-INFO
5
7
  toolfor_debug.egg-info/SOURCES.txt
6
8
  toolfor_debug.egg-info/dependency_links.txt
@@ -0,0 +1 @@
1
+ toolfor_debug
File without changes
File without changes