diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 855b2b1..02e94d3 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -8,10 +8,10 @@
-
-
-
-
+
+
+
+
@@ -19,4 +19,4 @@
-
\ No newline at end of file
+
diff --git a/doc/source/PrettyFormat.rst b/doc/source/PrettyFormat.rst
index 201d2cc..a39d7c7 100644
--- a/doc/source/PrettyFormat.rst
+++ b/doc/source/PrettyFormat.rst
@@ -52,19 +52,21 @@ API: Helpers: `pretty_repr`, `pretty_str` and base class `PrettyFormat`.
:rtype: str
-.. py:class:: PrettyFormat(max_indent=20, indent_step=4, py2_str=False, )
+.. py:class:: PrettyFormat(object)
Designed for usage as __repr__ and __str__ replacement on complex objects
.. versionadded:: 1.0.2
.. versionchanged:: 3.0.1
- :param max_indent: maximal indent before classic repr() call
- :type max_indent: int
- :param indent_step: step for the next indentation level
- :type indent_step: int
- :param py2_str: use Python 2.x compatible strings instead of unicode
- :type py2_str: bool
+ .. py:method:: __init__(max_indent=20, indent_step=4, py2_str=False, )
+
+ :param max_indent: maximal indent before classic repr() call
+ :type max_indent: int
+ :param indent_step: step for the next indentation level
+ :type indent_step: int
+ :param py2_str: use Python 2.x compatible strings instead of unicode
+ :type py2_str: bool
.. note:: Attributes is read-only
@@ -115,31 +117,35 @@ API: Helpers: `pretty_repr`, `pretty_str` and base class `PrettyFormat`.
:rtype: str
-.. py:class:: PrettyRepr(max_indent=20, indent_step=4, py2_str=False, )
+.. py:class:: PrettyRepr(PrettyFormat)
Designed for usage as __repr__ replacement on complex objects
.. versionadded:: 3.0.0
.. versionchanged:: 3.0.1
- :param max_indent: maximal indent before classic repr() call
- :type max_indent: int
- :param indent_step: step for the next indentation level
- :type indent_step: int
- :param py2_str: use Python 2.x compatible strings instead of unicode
- :type py2_str: bool
+ .. py:method:: __init__(max_indent=20, indent_step=4, py2_str=False, )
+
+ :param max_indent: maximal indent before classic repr() call
+ :type max_indent: int
+ :param indent_step: step for the next indentation level
+ :type indent_step: int
+ :param py2_str: use Python 2.x compatible strings instead of unicode
+ :type py2_str: bool
-.. py:class:: PrettyStr(max_indent=20, indent_step=4, py2_str=False, )
+.. py:class:: PrettyStr(PrettyFormat)
Designed for usage as __repr__ replacement on complex objects
.. versionadded:: 3.0.0
.. versionchanged:: 3.0.1
- :param max_indent: maximal indent before classic repr() call
- :type max_indent: int
- :param indent_step: step for the next indentation level
- :type indent_step: int
- :param py2_str: use Python 2.x compatible strings instead of unicode
- :type py2_str: bool
+ .. py:method:: __init__(max_indent=20, indent_step=4, py2_str=False, )
+
+ :param max_indent: maximal indent before classic repr() call
+ :type max_indent: int
+ :param indent_step: step for the next indentation level
+ :type indent_step: int
+ :param py2_str: use Python 2.x compatible strings instead of unicode
+ :type py2_str: bool
diff --git a/doc/source/logwrap.rst b/doc/source/logwrap.rst
index ea9a37b..e12484f 100644
--- a/doc/source/logwrap.rst
+++ b/doc/source/logwrap.rst
@@ -6,41 +6,43 @@ API: Decorators: `LogWrap` class and `logwrap` function.
.. py:module:: logwrap
.. py:currentmodule:: logwrap
-.. py:class:: LogWrap(log=logging.getLogger('logwrap'), log_level=logging.DEBUG, exc_level=logging.ERROR, max_indent=20, spec=None, blacklisted_names=None, blacklisted_exceptions=None, log_call_args=True, log_call_args_on_exc=True, log_result_obj=True, )
+.. py:class:: LogWrap(object)
Log function calls and return values.
.. versionadded:: 2.2.0
- :param log: logger object for decorator, by default used 'logwrap'
- :type log: typing.Union[logging.Logger, typing.Callable]
- :param log_level: log level for successful calls
- :type log_level: int
- :param exc_level: log level for exception cases
- :type exc_level: int
- :param max_indent: maximum indent before classic `repr()` call.
- :type max_indent: int
- :param spec: callable object used as spec for arguments bind.
- This is designed for the special cases only,
- when impossible to change signature of target object,
- but processed/redirected signature is accessible.
- Note: this object should provide fully compatible
- signature with decorated function, or arguments bind
- will be failed!
- :type spec: typing.Optional[typing.Callable]
- :param blacklisted_names: Blacklisted argument names.
- Arguments with this names will be skipped in log.
- :type blacklisted_names: typing.Optional[typing.Iterable[str]]
- :param blacklisted_exceptions: list of exception,
- which should be re-raised without
- producing log record.
- :type blacklisted_exceptions: typing.Optional[typing.Iterable[Exception]]
- :param log_call_args: log call arguments before executing wrapped function.
- :type log_call_args: bool
- :param log_call_args_on_exc: log call arguments if exception raised.
- :type log_call_args_on_exc: bool
- :param log_result_obj: log result of function call.
- :type log_result_obj: bool
+ .. py:method:: __init__(log=logging.getLogger('logwrap'), log_level=logging.DEBUG, exc_level=logging.ERROR, max_indent=20, spec=None, blacklisted_names=None, blacklisted_exceptions=None, log_call_args=True, log_call_args_on_exc=True, log_result_obj=True, )
+
+ :param log: logger object for decorator, by default used 'logwrap'
+ :type log: typing.Union[logging.Logger, typing.Callable]
+ :param log_level: log level for successful calls
+ :type log_level: int
+ :param exc_level: log level for exception cases
+ :type exc_level: int
+ :param max_indent: maximum indent before classic `repr()` call.
+ :type max_indent: int
+ :param spec: callable object used as spec for arguments bind.
+ This is designed for the special cases only,
+ when impossible to change signature of target object,
+ but processed/redirected signature is accessible.
+ Note: this object should provide fully compatible
+ signature with decorated function, or arguments bind
+ will be failed!
+ :type spec: typing.Optional[typing.Callable]
+ :param blacklisted_names: Blacklisted argument names.
+ Arguments with this names will be skipped in log.
+ :type blacklisted_names: typing.Optional[typing.Iterable[str]]
+ :param blacklisted_exceptions: list of exception,
+ which should be re-raised without
+ producing log record.
+ :type blacklisted_exceptions: typing.Optional[typing.Iterable[Exception]]
+ :param log_call_args: log call arguments before executing wrapped function.
+ :type log_call_args: bool
+ :param log_call_args_on_exc: log call arguments if exception raised.
+ :type log_call_args_on_exc: bool
+ :param log_result_obj: log result of function call.
+ :type log_result_obj: bool
.. note:: Attributes/properties names the same as argument names and changes
the same fields.
diff --git a/logwrap/_class_decorator.py b/logwrap/_class_decorator.py
index 30b8ebc..c0cfc64 100644
--- a/logwrap/_class_decorator.py
+++ b/logwrap/_class_decorator.py
@@ -19,12 +19,12 @@
import abc
import functools
import sys
-import typing
+import typing # noqa # pylint: disable=unused-import
PY3 = sys.version_info[:2] > (3, 0)
-class BaseDecorator(typing.Callable):
+class BaseDecorator(object):
"""Base class for decorators.
Implements wrapping and __call__, wrapper getter is abstract.
@@ -33,7 +33,7 @@ class BaseDecorator(typing.Callable):
def __init__(
self,
func=None # type: typing.Optional[typing.Callable]
- ):
+ ): # type: (...) -> None
"""Decorator.
:param func: function to wrap
diff --git a/logwrap/_log_wrap_shared.py b/logwrap/_log_wrap_shared.py
index 1ad1f2f..e3a95d3 100644
--- a/logwrap/_log_wrap_shared.py
+++ b/logwrap/_log_wrap_shared.py
@@ -102,8 +102,7 @@ def __init__(
log_call_args=True, # type: bool
log_call_args_on_exc=True, # type: bool
log_result_obj=True, # type: bool
-
- ):
+ ): # type: (...) -> None
"""Log function calls and return values.
:param log: logger object for decorator, by default used 'logwrap'
diff --git a/logwrap/_repr_utils.py b/logwrap/_repr_utils.py
index 8ff13d9..99ee6e8 100644
--- a/logwrap/_repr_utils.py
+++ b/logwrap/_repr_utils.py
@@ -100,7 +100,7 @@ def __init__(
max_indent=20, # type: int
indent_step=4, # type: int
py2_str=False, # type: bool
- ):
+ ): # type: (...) -> None
"""Pretty Formatter.
:param max_indent: maximal indent before classic repr() call
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..be03eaa
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,7 @@
+[build-system]
+# Minimum requirements for the build system to execute.
+# PEP 508 specifications for PEP 518.
+requires = [
+ "setuptools > 20.2 ",
+ "wheel",
+]