log21 2.5.1__tar.gz → 2.5.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.
Files changed (26) hide show
  1. {log21-2.5.1 → log21-2.5.2}/PKG-INFO +4 -4
  2. {log21-2.5.1 → log21-2.5.2}/README.md +2 -2
  3. {log21-2.5.1 → log21-2.5.2}/log21/Argparse.py +4 -2
  4. {log21-2.5.1 → log21-2.5.2}/log21/Formatters.py +14 -11
  5. {log21-2.5.1 → log21-2.5.2}/log21/Logger.py +5 -4
  6. {log21-2.5.1 → log21-2.5.2}/log21/PPrint.py +5 -5
  7. {log21-2.5.1 → log21-2.5.2}/log21/ProgressBar.py +9 -7
  8. {log21-2.5.1 → log21-2.5.2}/log21/StreamHandler.py +2 -1
  9. {log21-2.5.1 → log21-2.5.2}/log21/TreePrint.py +18 -15
  10. {log21-2.5.1 → log21-2.5.2}/log21/__init__.py +17 -17
  11. {log21-2.5.1 → log21-2.5.2}/log21.egg-info/PKG-INFO +4 -4
  12. {log21-2.5.1 → log21-2.5.2}/pyproject.toml +2 -2
  13. {log21-2.5.1 → log21-2.5.2}/LICENSE.txt +0 -0
  14. {log21-2.5.1 → log21-2.5.2}/log21/Colors.py +0 -0
  15. {log21-2.5.1 → log21-2.5.2}/log21/CrashReporter/Formatters.py +0 -0
  16. {log21-2.5.1 → log21-2.5.2}/log21/CrashReporter/Reporters.py +0 -0
  17. {log21-2.5.1 → log21-2.5.2}/log21/CrashReporter/__init__.py +0 -0
  18. {log21-2.5.1 → log21-2.5.2}/log21/FileHandler.py +0 -0
  19. {log21-2.5.1 → log21-2.5.2}/log21/Levels.py +0 -0
  20. {log21-2.5.1 → log21-2.5.2}/log21/LoggingWindow.py +0 -0
  21. {log21-2.5.1 → log21-2.5.2}/log21/Manager.py +0 -0
  22. {log21-2.5.1 → log21-2.5.2}/log21.egg-info/SOURCES.txt +0 -0
  23. {log21-2.5.1 → log21-2.5.2}/log21.egg-info/dependency_links.txt +0 -0
  24. {log21-2.5.1 → log21-2.5.2}/log21.egg-info/requires.txt +0 -0
  25. {log21-2.5.1 → log21-2.5.2}/log21.egg-info/top_level.txt +0 -0
  26. {log21-2.5.1 → log21-2.5.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: log21
3
- Version: 2.5.1
3
+ Version: 2.5.2
4
4
  Summary: A simple logging package that helps you log colorized messages in Windows console.
5
5
  Author-email: "CodeWriter21(Mehrad Pooryoussof)" <CodeWriter21@gmail.com>
6
6
  License: Apache License 2.0
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Operating System :: Unix
17
17
  Classifier: Operating System :: Microsoft :: Windows
18
18
  Classifier: Operating System :: MacOS :: MacOS X
19
- Requires-Python: >=3.6
19
+ Requires-Python: >=3.7
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
22
 
@@ -75,9 +75,9 @@ python setup.py install
75
75
  Changes
76
76
  -------
77
77
 
78
- ### 2.5.1
78
+ ### 2.5.2
79
79
 
80
- Switched from `setup.py` build system to `pyproject.toml`
80
+ Improved type-hintings.
81
81
 
82
82
  [Full CHANGELOG](https://github.com/MPCodeWriter21/log21/blob/master/CHANGELOG.md)
83
83
 
@@ -53,9 +53,9 @@ python setup.py install
53
53
  Changes
54
54
  -------
55
55
 
56
- ### 2.5.1
56
+ ### 2.5.2
57
57
 
58
- Switched from `setup.py` build system to `pyproject.toml`
58
+ Improved type-hintings.
59
59
 
60
60
  [Full CHANGELOG](https://github.com/MPCodeWriter21/log21/blob/master/CHANGELOG.md)
61
61
 
@@ -5,9 +5,11 @@ import re as _re
5
5
  import sys as _sys
6
6
  import log21 as _log21
7
7
  import argparse as _argparse
8
- from typing import Mapping as _Mapping
8
+
9
9
  from gettext import gettext as _gettext
10
10
  from textwrap import TextWrapper as _TextWrapper
11
+ from typing import Mapping as _Mapping, Optional as _Optional
12
+
11
13
  from log21.Colors import get_colors as _gc
12
14
  from log21.Formatters import DecolorizingFormatter as _Formatter
13
15
 
@@ -477,7 +479,7 @@ class ColorizingTextWrapper(_TextWrapper):
477
479
 
478
480
 
479
481
  class ColorizingArgumentParser(_argparse.ArgumentParser):
480
- def __init__(self, formatter_class=ColorizingHelpFormatter, colors: _Mapping[str, str] = None, **kwargs):
482
+ def __init__(self, formatter_class=ColorizingHelpFormatter, colors: _Optional[_Mapping[str, str]] = None, **kwargs):
481
483
  self.logger = _log21.Logger('ArgumentParser')
482
484
  self.colors = colors
483
485
  super().__init__(formatter_class=formatter_class, **kwargs)
@@ -3,7 +3,7 @@
3
3
 
4
4
  import time as _time
5
5
  from logging import Formatter as __Formatter
6
- from typing import Mapping as _Mapping, Tuple as _Tuple
6
+ from typing import Mapping as _Mapping, Tuple as _Tuple, Dict as _Dict, Optional as _Optional
7
7
  from log21.Colors import get_colors as _gc, ansi_escape
8
8
  from log21.Levels import INPUT, CRITICAL, ERROR, WARNING, INFO, DEBUG, PRINT
9
9
 
@@ -11,7 +11,7 @@ __all__ = ['ColorizingFormatter', 'DecolorizingFormatter']
11
11
 
12
12
 
13
13
  class _Formatter(__Formatter):
14
- _level_names: _Mapping[int, str] = {
14
+ _level_names: _Dict[int, str] = {
15
15
  DEBUG: 'DEBUG',
16
16
  INFO: 'INFO',
17
17
  WARNING: 'WARNING',
@@ -21,7 +21,8 @@ class _Formatter(__Formatter):
21
21
  INPUT: 'INPUT'
22
22
  }
23
23
 
24
- def __init__(self, fmt: str = None, datefmt: str = None, style: str = '%', level_names: _Mapping[int, str] = None):
24
+ def __init__(self, fmt: _Optional[str] = None, datefmt: _Optional[str] = None, style: str = '%',
25
+ level_names: _Optional[_Mapping[int, str]] = None):
25
26
  """
26
27
  `level_names` usage:
27
28
  >>> import log21
@@ -57,7 +58,7 @@ class _Formatter(__Formatter):
57
58
  return self._level_names
58
59
 
59
60
  @level_names.setter
60
- def level_names(self, level_names):
61
+ def level_names(self, level_names: _Mapping[int, str]):
61
62
  if level_names:
62
63
  if not isinstance(level_names, _Mapping):
63
64
  raise TypeError('`level_names` must be a Mapping, a dictionary like object!')
@@ -89,7 +90,7 @@ class _Formatter(__Formatter):
89
90
 
90
91
  class ColorizingFormatter(_Formatter):
91
92
  # Default color values
92
- level_colors: _Mapping[int, _Tuple[str, ...]] = {
93
+ level_colors: _Dict[int, _Tuple[str, ...]] = {
93
94
  DEBUG: ('lightblue',),
94
95
  INFO: ('green',),
95
96
  WARNING: ('lightyellow',),
@@ -102,12 +103,14 @@ class ColorizingFormatter(_Formatter):
102
103
  name_color = pathname_color = filename_color = module_color = func_name_color = thread_name_color = \
103
104
  message_color = tuple()
104
105
 
105
- def __init__(self, fmt: str = None, datefmt: str = None, style: str = '%', level_names: _Mapping[int, str] = None,
106
- level_colors: _Mapping[int, _Tuple[str]] = None,
107
- time_color: _Tuple[str, ...] = None, name_color: _Tuple[str, ...] = None,
108
- pathname_color: _Tuple[str, ...] = None, filename_color: _Tuple[str, ...] = None,
109
- module_color: _Tuple[str, ...] = None, func_name_color: _Tuple[str, ...] = None,
110
- thread_name_color: _Tuple[str, ...] = None, message_color: _Tuple[str, ...] = None):
106
+ def __init__(self, fmt: _Optional[str] = None, datefmt: _Optional[str] = None, style: str = '%',
107
+ level_names: _Optional[_Mapping[int, str]] = None,
108
+ level_colors: _Optional[_Mapping[int, _Tuple[str]]] = None,
109
+ time_color: _Optional[_Tuple[str, ...]] = None, name_color: _Optional[_Tuple[str, ...]] = None,
110
+ pathname_color: _Optional[_Tuple[str, ...]] = None, filename_color: _Optional[_Tuple[str, ...]] = None,
111
+ module_color: _Optional[_Tuple[str, ...]] = None, func_name_color: _Optional[_Tuple[str, ...]] = None,
112
+ thread_name_color: _Optional[_Tuple[str, ...]] = None,
113
+ message_color: _Optional[_Tuple[str, ...]] = None):
111
114
  super().__init__(fmt=fmt, datefmt=datefmt, style=style, level_names=level_names)
112
115
  # Checks and sets colors
113
116
  if level_colors:
@@ -4,7 +4,7 @@
4
4
  import logging as _logging
5
5
 
6
6
  from getpass import getpass as _getpass
7
- from typing import Sequence as _Sequence, Union as _Union
7
+ from typing import Sequence as _Sequence, Union as _Union, Optional as _Optional, Callable as _Callable
8
8
  from logging import raiseExceptions as _raiseExceptions
9
9
 
10
10
  import log21 as _log21
@@ -14,7 +14,8 @@ __all__ = ['Logger']
14
14
 
15
15
 
16
16
  class Logger(_logging.Logger):
17
- def __init__(self, name, level=NOTSET, handlers: _Union[_Sequence[_logging.Handler], _logging.Handler] = None):
17
+ def __init__(self, name, level: _Union[int, str]=NOTSET,
18
+ handlers: _Optional[_Union[_Sequence[_logging.Handler], _logging.Handler]] = None):
18
19
  super().__init__(name, level)
19
20
  self.setLevel(level)
20
21
  self._progress_bar = None
@@ -192,7 +193,7 @@ class Logger(_logging.Logger):
192
193
  def progress_bar(self, value: '_log21.ProgressBar'):
193
194
  self._progress_bar = value
194
195
 
195
- def clear_line(self, length: int = None):
196
+ def clear_line(self, length: _Optional[int] = None):
196
197
  """
197
198
  Clear the current line.
198
199
 
@@ -200,5 +201,5 @@ class Logger(_logging.Logger):
200
201
  :return:
201
202
  """
202
203
  for handler in self.handlers:
203
- if hasattr(handler, 'clear_line'):
204
+ if isinstance(getattr(handler, 'clear_line', None), _Callable):
204
205
  handler.clear_line(length)
@@ -7,8 +7,8 @@ import types as _types
7
7
  import collections as _collections
8
8
  import dataclasses as _dataclasses
9
9
 
10
- from typing import Mapping as _Mapping, Union as _Union
11
10
  from pprint import PrettyPrinter as _PrettyPrinter
11
+ from typing import Mapping as _Mapping, Optional as _Optional
12
12
 
13
13
  from log21.Colors import get_colors as _gc
14
14
 
@@ -75,8 +75,8 @@ class PrettyPrinter(_PrettyPrinter):
75
75
  'data': _gc('Green')
76
76
  }
77
77
 
78
- def __init__(self, indent=1, width=80, depth=None, stream=None, signs_colors: _Mapping[str, str] = None, *,
79
- compact=False, sort_dicts=True, underscore_numbers=False, **kwargs):
78
+ def __init__(self, indent=1, width=80, depth=None, stream=None, signs_colors: _Optional[_Mapping[str, str]] = None,
79
+ *, compact=False, sort_dicts=True, underscore_numbers=False, **kwargs):
80
80
  super().__init__(indent=indent, width=width, depth=depth, stream=stream, compact=compact, **kwargs)
81
81
  self._depth = depth
82
82
  self._indent_per_level = indent
@@ -562,8 +562,8 @@ class PrettyPrinter(_PrettyPrinter):
562
562
  _dispatch[_collections.UserString.__repr__] = _pprint_user_string
563
563
 
564
564
 
565
- def pformat(obj, indent=1, width=80, depth=None, signs_colors: _Mapping[str, str] = None, *, compact=False,
565
+ def pformat(obj, indent=1, width=80, depth=None, signs_colors: _Optional[_Mapping[str, str]] = None, *, compact=False,
566
566
  sort_dicts=True, underscore_numbers=False, **kwargs):
567
567
  """Format a Python object into a pretty-printed representation."""
568
568
  return PrettyPrinter(indent=indent, width=width, depth=depth, compact=compact, signs_colors=signs_colors,
569
- sort_dicts=True, underscore_numbers=False, **kwargs).pformat(obj)
569
+ sort_dicts=sort_dicts, underscore_numbers=underscore_numbers, **kwargs).pformat(obj)
@@ -1,9 +1,11 @@
1
1
  # log21.ProgressBar.py
2
2
  # CodeWriter21
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  import shutil as _shutil
5
7
 
6
- from typing import Mapping as _Mapping, Any as _Any
8
+ from typing import Mapping as _Mapping, Any as _Any, Optional as _Optional
7
9
 
8
10
  import log21 as _log21
9
11
  from log21.Logger import Logger as _Logger
@@ -39,10 +41,10 @@ class ProgressBar:
39
41
  >>>
40
42
  """
41
43
 
42
- def __init__(self, *args, width: int = None, show_percentage: bool = True, prefix: str = '|', suffix: str = '|',
43
- fill: str = '█', empty: str = ' ', format_: str = None, style: str = '%',
44
- new_line_when_complete: bool = True, colors: dict = None, no_color: bool = False,
45
- logger: '_log21.Logger' = _logger, additional_variables: _Mapping[str, _Any] = None):
44
+ def __init__(self, *, width: _Optional[int] = None, show_percentage: bool = True, prefix: str = '|',
45
+ suffix: str = '|', fill: str = '█', empty: str = ' ', format_: _Optional[str] = None, style: str = '%',
46
+ new_line_when_complete: bool = True, colors: _Optional[_Mapping[str, str]] = None, no_color: bool = False,
47
+ logger: _log21.Logger = _logger, additional_variables: _Optional[_Mapping[str, _Any]] = None):
46
48
  """
47
49
  :param args: Prevents the use of positional arguments
48
50
  :param width: The width of the progress bar
@@ -274,11 +276,11 @@ class ProgressBar:
274
276
 
275
277
  return '\r' + bar + self.colors['reset-color'] + ('\n' if self.new_line_when_complete else '')
276
278
 
277
- def __call__(self, progress: float, total: float, logger: '_log21.Logger' = None, **kwargs):
279
+ def __call__(self, progress: float, total: float, logger: _Optional[_log21.Logger] = None, **kwargs):
278
280
  if not logger:
279
281
  logger = self.logger
280
282
 
281
283
  logger.print(self.get_bar(progress, total, **kwargs), end='')
282
284
 
283
- def update(self, progress: float, total: float, logger: '_log21.Logger' = None, **kwargs):
285
+ def update(self, progress: float, total: float, logger: _Optional[_log21.Logger] = None, **kwargs):
284
286
  self(progress, total, logger, **kwargs)
@@ -6,6 +6,7 @@ import re as _re
6
6
  import shutil as _shutil
7
7
 
8
8
  from logging import StreamHandler as _StreamHandler
9
+ from typing import Optional as _Optional
9
10
  from log21.Colors import ansi_escape as _ansi_escape, get_colors as _gc, hex_escape as _hex_escape
10
11
 
11
12
  __all__ = ['IS_WINDOWS', 'ColorizingStreamHandler', 'StreamHandler']
@@ -59,7 +60,7 @@ class StreamHandler(_StreamHandler):
59
60
  self.check_nl(record)
60
61
  super().emit(record)
61
62
 
62
- def clear_line(self, length: int = None):
63
+ def clear_line(self, length: _Optional[int] = None):
63
64
  """
64
65
  Clear the current line.
65
66
 
@@ -1,7 +1,9 @@
1
1
  # log21.TreePrint.py
2
2
  # CodeWriter21
3
3
 
4
- from typing import Union as _Union, Mapping as _Mapping, Sequence as _Sequence
4
+ from __future__ import annotations
5
+
6
+ from typing import Union as _Union, Mapping as _Mapping, Sequence as _Sequence, Optional as _Optional, List as _List
5
7
 
6
8
  from log21.Colors import get_colors as _gc
7
9
 
@@ -13,8 +15,8 @@ class TreePrint:
13
15
  'fruit': _gc('LightMagenta'),
14
16
  }
15
17
 
16
- def __init__(self, value: _Union[str, int], children: list = None, indent: int = 4,
17
- colors: _Mapping[str, str] = None, mode='-'):
18
+ def __init__(self, value: _Union[str, int], children: _Optional[_List[TreePrint.Node]] = None, indent: int = 4,
19
+ colors: _Optional[_Mapping[str, str]] = None, mode: str='-'):
18
20
  self.value = str(value)
19
21
  if children:
20
22
  self._children = children
@@ -33,16 +35,17 @@ class TreePrint:
33
35
  if self.mode == -1:
34
36
  raise ValueError('`mode` must be - or =')
35
37
 
36
- def _get_mode(self, mode=None) -> int:
38
+ def _get_mode(self, mode: _Optional[_Union[str, int]] = None) -> int:
37
39
  if not mode:
38
40
  mode = self.mode
39
41
  if isinstance(mode, int):
40
42
  if mode in [1, 2]:
41
43
  return mode
42
- if mode in '-_─┌│|└┬├└':
43
- return 1
44
- if mode in '=═╔║╠╚╦╚':
45
- return 2
44
+ elif isinstance(mode, str):
45
+ if mode in '-_─┌│|└┬├└':
46
+ return 1
47
+ if mode in '=═╔║╠╚╦╚':
48
+ return 2
46
49
  return -1
47
50
 
48
51
  def __str__(self, level=0, prefix='', mode=None):
@@ -88,12 +91,12 @@ class TreePrint:
88
91
  def has_child(self):
89
92
  return len(self._children) > 0
90
93
 
91
- def add_child(self, child: 'TreePrint.Node'):
94
+ def add_child(self, child: TreePrint.Node):
92
95
  if not isinstance(child, TreePrint.Node):
93
96
  raise TypeError('`child` must be TreePrint.Node')
94
97
  self._children.append(child)
95
98
 
96
- def get_child(self, value: str = None, index: int = None):
99
+ def get_child(self, value: _Optional[str] = None, index: _Optional[int] = None):
97
100
  if value and index:
98
101
  raise ValueError('`value` and `index` can not be both set')
99
102
  if not value and not index:
@@ -106,8 +109,8 @@ class TreePrint:
106
109
  return self._children[index]
107
110
 
108
111
  @staticmethod
109
- def add_to(node: 'TreePrint.Node', data: _Union[_Mapping, _Sequence, str, int], indent: int = 4,
110
- colors: _Mapping[str, str] = None, mode='-'):
112
+ def add_to(node: TreePrint.Node, data: _Union[_Mapping, _Sequence, str, int], indent: int = 4,
113
+ colors: _Optional[_Mapping[str, str]] = None, mode='-'):
111
114
  if isinstance(data, _Mapping):
112
115
  if len(data) == 1:
113
116
  child = TreePrint.Node(list(data.keys())[0], indent=indent, colors=colors, mode=mode)
@@ -137,7 +140,7 @@ class TreePrint:
137
140
  node.add_child(child)
138
141
 
139
142
  def __init__(self, data: _Union[_Mapping, _Sequence, str, int], indent: int = 4,
140
- colors: _Mapping[str, str] = None, mode='-'):
143
+ colors: _Optional[_Mapping[str, str]] = None, mode='-'):
141
144
  self.indent = indent
142
145
  self.mode = mode
143
146
  if isinstance(data, _Mapping):
@@ -153,7 +156,7 @@ class TreePrint:
153
156
  else:
154
157
  self.root = self.Node(str(data), indent=indent, colors=colors)
155
158
 
156
- def add_to_root(self, data: _Union[_Mapping, _Sequence, str, int], colors: _Mapping[str, str] = None):
159
+ def add_to_root(self, data: _Union[_Mapping, _Sequence, str, int], colors: _Optional[_Mapping[str, str]] = None):
157
160
  self.Node.add_to(self.root, data, indent=self.indent, colors=colors, mode=self.mode)
158
161
 
159
162
  def __str__(self, mode=None):
@@ -163,5 +166,5 @@ class TreePrint:
163
166
 
164
167
 
165
168
  def tree_format(data: _Union[_Mapping, _Sequence, str, int], indent: int = 4, mode='-',
166
- colors: _Mapping[str, str] = None):
169
+ colors: _Optional[_Mapping[str, str]] = None):
167
170
  return str(TreePrint(data, indent=indent, colors=colors, mode=mode))
@@ -5,7 +5,7 @@ import io as _io
5
5
  import os as _os
6
6
  import logging as _logging
7
7
 
8
- from typing import Union as _Union, Mapping as _Mapping, Type as _Type, Tuple as _Tuple
8
+ from typing import Union as _Union, Mapping as _Mapping, Type as _Type, Tuple as _Tuple, Optional as _Optional
9
9
 
10
10
  import log21.CrashReporter as CrashReporter
11
11
 
@@ -22,12 +22,12 @@ from log21.StreamHandler import ColorizingStreamHandler, StreamHandler
22
22
  from log21.Formatters import ColorizingFormatter, DecolorizingFormatter
23
23
  from log21.Colors import Colors, get_color, get_colors, ansi_escape, get_color_name, closest_color
24
24
 
25
- __version__ = "2.5.1"
25
+ __version__ = "2.5.2"
26
26
  __author__ = "CodeWriter21 (Mehrad Pooryoussof)"
27
27
  __github__ = "Https://GitHub.com/MPCodeWriter21/log21"
28
28
  __all__ = ['ColorizingStreamHandler', 'DecolorizingFileHandler', 'ColorizingFormatter', 'DecolorizingFormatter',
29
29
  'get_logger', 'Logger', 'Colors', 'get_color', 'get_colors', 'CRITICAL', 'FATAL', 'ERROR', 'WARNING', 'WARN',
30
- 'INFO', 'DEBUG', 'NOTSET', 'StreamHandler', 'ColorizingArgumentParser', 'PrettyPrinter', 'pformat',
30
+ 'INFO', 'DEBUG', 'NOTSET', 'INPUT', 'StreamHandler', 'ColorizingArgumentParser', 'PrettyPrinter', 'pformat',
31
31
  'pprint', 'pretty_print', 'tree_format', 'TreePrint', 'Manager', 'get_color_name', 'closest_color',
32
32
  'ansi_escape', '__version__', '__author__', '__github__', 'debug', 'info', 'warning', 'warn', 'error',
33
33
  'critical', 'fatal', 'exception', 'log', 'basic_config', 'basicConfig', 'ProgressBar', 'progress_bar',
@@ -38,10 +38,10 @@ _manager = Manager()
38
38
  _logging.setLoggerClass(Logger)
39
39
 
40
40
 
41
- def _prepare_formatter(fmt: str = None, style: str = '%', datefmt: str = "%H:%M:%S", show_level: bool = True,
42
- show_time: bool = True, colorize_time_and_level: bool = True,
43
- level_names: _Mapping[int, str] = None,
44
- level_colors: _Mapping[int, _Tuple[str, ...]] = None,
41
+ def _prepare_formatter(fmt: _Optional[str] = None, style: str = '%', datefmt: str = "%H:%M:%S",
42
+ show_level: bool = True, show_time: bool = True, colorize_time_and_level: bool = True,
43
+ level_names: _Optional[_Mapping[int, str]] = None,
44
+ level_colors: _Optional[_Mapping[int, _Tuple[str, ...]]] = None,
45
45
  formatter_class: _Type[_logging.Formatter] = ColorizingFormatter):
46
46
  # Prepares a formatting if the fmt was None
47
47
  if not fmt:
@@ -55,7 +55,7 @@ def _prepare_formatter(fmt: str = None, style: str = '%', datefmt: str = "%H:%M:
55
55
 
56
56
  if level_colors and not issubclass(formatter_class, ColorizingFormatter):
57
57
  warning('`formatter_class` should be a subclass of ColorizingFormatter when used with level_colors.')
58
- warning(f'Using `{formatter_class.__class__.__name__}` might lead to unexpected behaviour!')
58
+ warning(f'Using `{formatter_class.__name__}` might lead to unexpected behaviour!')
59
59
 
60
60
  # Defines the formatter
61
61
  if level_colors:
@@ -74,11 +74,11 @@ def _prepare_formatter(fmt: str = None, style: str = '%', datefmt: str = "%H:%M:
74
74
 
75
75
 
76
76
  def get_logger(name: str = '', level: _Union[int, str] = NOTSET, show_time: bool = True,
77
- show_level: bool = True, colorize_time_and_level: bool = True, fmt: str = None,
77
+ show_level: bool = True, colorize_time_and_level: bool = True, fmt: _Optional[str] = None,
78
78
  datefmt: str = "%H:%M:%S", style: str = '%', handle_carriage_return: bool = True,
79
- handle_new_line: bool = True, override=False, level_names: _Mapping[int, str] = None,
80
- level_colors: _Mapping[int, _Tuple[str, ...]] = None,
81
- file: _Union[_os.PathLike, str] = None) -> Logger:
79
+ handle_new_line: bool = True, override=False, level_names: _Optional[_Mapping[int, str]] = None,
80
+ level_colors: _Optional[_Mapping[int, _Tuple[str, ...]]] = None,
81
+ file: _Optional[_Union[_os.PathLike, str]] = None) -> _Union[Logger, _logging.Logger]:
82
82
  """
83
83
  Returns a logging.Logger with colorizing support.
84
84
  >>>
@@ -169,9 +169,9 @@ def get_logger(name: str = '', level: _Union[int, str] = NOTSET, show_time: bool
169
169
 
170
170
 
171
171
  def get_logging_window(name: str = '', level: _Union[int, str] = NOTSET, show_time: bool = True,
172
- show_level: bool = True, colorize_time_and_level: bool = True, fmt: str = None,
172
+ show_level: bool = True, colorize_time_and_level: bool = True, fmt: _Optional[str] = None,
173
173
  datefmt: str = "%H:%M:%S", style: str = '%', handle_carriage_return: bool = True,
174
- handle_new_line: bool = True, override=False, level_names: _Mapping[int, str] = None,
174
+ handle_new_line: bool = True, override=False, level_names: _Optional[_Mapping[int, str]] = None,
175
175
  width: int = 80, height: int = 20, allow_shell: bool = False) -> LoggingWindow:
176
176
  """
177
177
  Returns a logging window.
@@ -262,7 +262,7 @@ def getpass(*msg, args: tuple = (), end='', **kwargs):
262
262
  return logger.getpass(*msg, args=args, end=end, **kwargs)
263
263
 
264
264
 
265
- def pprint(obj, indent=1, width=80, depth=None, signs_colors: _Mapping[str, str] = None, *, sort_dicts=True,
265
+ def pprint(obj, indent=1, width=80, depth=None, signs_colors: _Optional[_Mapping[str, str]] = None, *, sort_dicts=True,
266
266
  underscore_numbers=False, compact=False, end='\033[0m\n', **kwargs):
267
267
  logger = get_logger('log21.pprint', level=DEBUG, show_time=False, show_level=False)
268
268
  logger.print(pformat(obj=obj, indent=indent, width=width, depth=depth, signs_colors=signs_colors, compact=compact,
@@ -282,7 +282,7 @@ tprint = tree_print
282
282
  root = Logger('root-logger', INFO)
283
283
 
284
284
 
285
- def basic_config(force: bool = False, encoding: str = None, errors: str = 'backslashreplace', handlers=None,
285
+ def basic_config(force: bool = False, encoding: str = None, errors: _Optional[str] = 'backslashreplace', handlers=None,
286
286
  stream=None, filename=None, filemode: str = 'a', date_format: str = "%H:%M:%S", style: str = '%',
287
287
  format_: str = None, level: _Union[int, str] = None):
288
288
  """
@@ -456,7 +456,7 @@ def log(level, *msg, args=(), **kwargs):
456
456
  root.log(level, *msg, args=args, **kwargs)
457
457
 
458
458
 
459
- def progress_bar(progress: float, total: float, width: int = None, prefix: str = '|', suffix: str = '|',
459
+ def progress_bar(progress: float, total: float, width: _Optional[int] = None, prefix: str = '|', suffix: str = '|',
460
460
  show_percentage: bool = True):
461
461
  """
462
462
  Print a progress bar to the console.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: log21
3
- Version: 2.5.1
3
+ Version: 2.5.2
4
4
  Summary: A simple logging package that helps you log colorized messages in Windows console.
5
5
  Author-email: "CodeWriter21(Mehrad Pooryoussof)" <CodeWriter21@gmail.com>
6
6
  License: Apache License 2.0
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Operating System :: Unix
17
17
  Classifier: Operating System :: Microsoft :: Windows
18
18
  Classifier: Operating System :: MacOS :: MacOS X
19
- Requires-Python: >=3.6
19
+ Requires-Python: >=3.7
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
22
 
@@ -75,9 +75,9 @@ python setup.py install
75
75
  Changes
76
76
  -------
77
77
 
78
- ### 2.5.1
78
+ ### 2.5.2
79
79
 
80
- Switched from `setup.py` build system to `pyproject.toml`
80
+ Improved type-hintings.
81
81
 
82
82
  [Full CHANGELOG](https://github.com/MPCodeWriter21/log21/blob/master/CHANGELOG.md)
83
83
 
@@ -9,7 +9,7 @@ authors = [
9
9
  ]
10
10
  description = "A simple logging package that helps you log colorized messages in Windows console."
11
11
  readme = {file = "README.md", content-type = "text/markdown"}
12
- requires-python = ">=3.6"
12
+ requires-python = ">=3.7"
13
13
  keywords = ['python', 'log', 'colorize', 'color', 'logging', 'Python3', 'CodeWriter21']
14
14
  license = {text = "Apache License 2.0"}
15
15
  classifiers = [
@@ -25,7 +25,7 @@ classifiers = [
25
25
  dependencies = [
26
26
  "webcolors"
27
27
  ]
28
- version = "2.5.1"
28
+ version = "2.5.2"
29
29
 
30
30
  [project.urls]
31
31
  Homepage = "https://github.com/MPCodeWriter21/log21"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes