Skip to content

Commit

Permalink
Minor fixes and improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
MPCodeWriter21 committed Aug 25, 2022
1 parent 5bb4c45 commit 32a4b28
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGES-LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Help this project by [Donation](DONATE.md)
Changes log
-----------

### 2.3.10

Minor fixes and improvements.

### 2.3.9

Minor fixes and improvements.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ python setup.py install
Changes
-------

### 2.3.9
### 2.3.10

Minor fixes and improvements.

Expand Down
15 changes: 8 additions & 7 deletions log21/CrashReporter/Reporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import smtplib as _smtplib # This module is used to send emails.

from os import PathLike as _PathLike
from typing import Callable as _Callable, Any as _Any, Union as _Union, IO as _IO, Set as _Set, Iterable as _Iterable
from typing import Callable as _Callable, Any as _Any, Union as _Union, IO as _IO, Set as _Set, Iterable as _Iterable, \
Type as _Type
from functools import wraps as _wraps
from email.mime.text import MIMEText as _MIMEText
from email.mime.multipart import MIMEMultipart as _MIMEMultipart
Expand Down Expand Up @@ -104,29 +105,29 @@ def wrap(*args, **kwargs):

return wrap

def catch(self, exception: BaseException):
def catch(self, exception: _Type[BaseException]):
"""
Add an exception to the list of exceptions to catch.
:param exception: Exception to catch.
"""
if not isinstance(exception, BaseException):
raise TypeError('`exception` must be an instance of BaseException')
if not issubclass(exception, BaseException):
raise TypeError('`exception` must be a subclass of BaseException.')
if self._exceptions_to_catch is None:
self._exceptions_to_catch = set()
if exception not in self._exceptions_to_catch:
self._exceptions_to_catch.add(exception)
else:
raise ValueError('exception is already in the list of exceptions to catch')

def ignore(self, exception: BaseException):
def ignore(self, exception: _Type[BaseException]):
"""
Add an exception to the list of exceptions to ignore.
:param exception: Exception to ignore.
"""
if not isinstance(exception, BaseException):
raise TypeError('`exception` must be an instance of BaseException')
if not issubclass(exception, BaseException):
raise TypeError('`exception` must be a subclass of BaseException.')
if self._exceptions_to_ignore is None:
self._exceptions_to_ignore = set()
if exception not in self._exceptions_to_ignore:
Expand Down
2 changes: 1 addition & 1 deletion log21/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from log21.Formatters import ColorizingFormatter, DecolorizingFormatter
from log21.Colors import Colors, get_color, get_colors, ansi_escape, get_color_name, closest_color

__version__ = "2.3.9"
__version__ = "2.3.10"
__author__ = "CodeWriter21 (Mehrad Pooryoussof)"
__github__ = "Https://GitHub.com/MPCodeWriter21/log21"
__all__ = ['ColorizingStreamHandler', 'DecolorizingFileHandler', 'ColorizingFormatter', 'DecolorizingFormatter',
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
long_description = file.read()

DESCRIPTION = 'A simple logging package that helps you log colorized messages in Windows console.'
VERSION = '2.3.9'
VERSION = '2.3.10'

setup(
name='log21',
Expand Down

0 comments on commit 32a4b28

Please sign in to comment.