nuf 0.0.1.dev1__tar.gz → 0.0.1.dev2__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: nuf
3
- Version: 0.0.1.dev1
3
+ Version: 0.0.1.dev2
4
4
  Summary: A versatile multi-file utility module, a series of useful code that is referenced from various projects that i repeatedly use.
5
5
  Author: Nathan Falvey
6
6
  Classifier: Programming Language :: Python :: 3
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nuf"
7
- version = "0.0.1.dev1"
7
+ version = "0.0.1.dev2"
8
8
  authors = [
9
9
  { name="Nathan Falvey" },
10
10
  ]
@@ -0,0 +1,50 @@
1
+ import colorama
2
+ from colorama import Fore, Style
3
+
4
+ # Initialize colorama (safe to call multiple times, handles Windows ANSI translation)
5
+ colorama.init(autoreset=True)
6
+
7
+
8
+ #
9
+ def console_colour_parser(string: str) -> str:
10
+ if string == "reset":
11
+ return Style.RESET_ALL
12
+ elif string == "info":
13
+ return Fore.BLUE
14
+ elif string == "success":
15
+ return Fore.GREEN
16
+ elif string == "warning":
17
+ return Fore.YELLOW
18
+ elif string == "error":
19
+ return Fore.RED
20
+ elif string == "critical":
21
+ return Fore.RED + Style.BRIGHT
22
+ elif string == "debug":
23
+ return Style.DIM
24
+ else:
25
+ return Style.RESET_ALL
26
+
27
+ def make_prefixed_message(text: str, style: str = "default") -> str:
28
+ return f"[{console_colour_parser(style)}{style.upper()}{console_colour_parser('reset')}] {text}"
29
+
30
+
31
+ def print_info(text: str) -> None:
32
+ print(make_prefixed_message(text, "info"))
33
+
34
+ def print_success(text: str) -> None:
35
+ print(make_prefixed_message(text, "success"))
36
+
37
+ def print_warning(text: str) -> None:
38
+ print(make_prefixed_message(text, "warning"))
39
+
40
+ def print_error(text: str) -> None:
41
+ print(make_prefixed_message(text, "error"))
42
+
43
+ def print_critical(text: str) -> None:
44
+ print(make_prefixed_message(text, "critical"))
45
+
46
+ def print_debug(text: str) -> None:
47
+ print(make_prefixed_message(text, "debug"))
48
+
49
+
50
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nuf
3
- Version: 0.0.1.dev1
3
+ Version: 0.0.1.dev2
4
4
  Summary: A versatile multi-file utility module, a series of useful code that is referenced from various projects that i repeatedly use.
5
5
  Author: Nathan Falvey
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,42 +0,0 @@
1
- import colorama
2
- from colorama import Fore, Style
3
-
4
- # Initialize colorama (safe to call multiple times, handles Windows ANSI translation)
5
- colorama.init(autoreset=True)
6
-
7
-
8
- COLOUR_TABLE = {
9
- "default": Style.RESET_ALL,
10
- "info": Fore.BLUE,
11
- "success": Fore.GREEN,
12
- "warning": Fore.YELLOW,
13
- "error": Fore.RED,
14
- "critical": Fore.RED + Style.BRIGHT,
15
- "debug": Style.DIM,
16
- }
17
-
18
- def message_func() -> str:
19
- return "Hello from message_utils"
20
-
21
-
22
- def bracketed_message_string(label: str, style: str = "default") -> str:
23
- return f"[{COLOUR_TABLE[style]}{label}{COLOUR_TABLE['default']}]"
24
-
25
- def print_warning(message: str, prefix_label: str = "WARNING") -> None:
26
- print(f"{bracketed_message_string(prefix_label, 'warning')} {message}")
27
-
28
- def print_error(message: str, prefix_label: str = "ERROR") -> None:
29
- print(f"{bracketed_message_string(prefix_label, 'error')} {message}")
30
-
31
- def print_success(message: str, prefix_label: str = "SUCCESS") -> None:
32
- print(f"{bracketed_message_string(prefix_label, 'success')} {message}")
33
-
34
- def print_info(message: str, prefix_label: str = "INFO") -> None:
35
- print(f"{bracketed_message_string(prefix_label, 'info')} {message}")
36
-
37
- def print_debug(message: str, prefix_label: str = "DEBUG") -> None:
38
- print(f"{bracketed_message_string(prefix_label, 'debug')} {message}")
39
-
40
- def print_critical(message: str, prefix_label: str = "CRITICAL") -> None:
41
- print(f"{bracketed_message_string(prefix_label, 'critical')} {message}")
42
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes