From 32a4b2808adf89bf45716ea0f6e454b149d2b424 Mon Sep 17 00:00:00 2001 From: CodeWriter21 Date: Thu, 25 Aug 2022 08:09:02 +0430 Subject: [PATCH] Minor fixes and improvements. --- CHANGES-LOG.md | 4 ++++ README.md | 2 +- log21/CrashReporter/Reporters.py | 15 ++++++++------- log21/__init__.py | 2 +- setup.py | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGES-LOG.md b/CHANGES-LOG.md index 408cc1c..110ad92 100644 --- a/CHANGES-LOG.md +++ b/CHANGES-LOG.md @@ -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. diff --git a/README.md b/README.md index 081e496..5251bf7 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ python setup.py install Changes ------- -### 2.3.9 +### 2.3.10 Minor fixes and improvements. diff --git a/log21/CrashReporter/Reporters.py b/log21/CrashReporter/Reporters.py index 28c8576..b1d23ae 100644 --- a/log21/CrashReporter/Reporters.py +++ b/log21/CrashReporter/Reporters.py @@ -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 @@ -104,14 +105,14 @@ 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: @@ -119,14 +120,14 @@ def catch(self, exception: BaseException): 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: diff --git a/log21/__init__.py b/log21/__init__.py index eaf175a..a0f015a 100644 --- a/log21/__init__.py +++ b/log21/__init__.py @@ -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', diff --git a/setup.py b/setup.py index b991361..161a29f 100644 --- a/setup.py +++ b/setup.py @@ -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',