Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit741dfd3

Browse files
committed
Deprecate git.util.NullHandler
The NullHandler class in git.util was added when merging#300, toallow a noop handler to be used on Python 2.6, since the standardlibrary logging.NullHandler class was added in Python 2.7.When introduced ind1a9a23, the git.util.NullHandler class was alsopatched into the logging module, but that has no longer been donesince2fced2e (#979), nor does GitPython make other use of it.This also changes the parameter type annotation on the emit methodfrom `object` to `logging.LogRecord`, which is the expeced type.
1 parentd28c20b commit741dfd3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

‎git/util.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,5 +1295,20 @@ def list_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> Any:
12951295

12961296

12971297
classNullHandler(logging.Handler):
1298-
defemit(self,record:object)->None:
1298+
"""Deprecated, use :class:`logging.NullHandler` instead.
1299+
1300+
This noop handler is like :class:`~logging.NullHandler` in the standard library,
1301+
which should be used instead, because it is now always available, and it overrides
1302+
more logging methods to make them noop. This class only overrides :meth:`emit`.
1303+
"""
1304+
1305+
def__init__(self,level:int=logging.NOTSET)->None:
1306+
warnings.warn(
1307+
"NullHandler in git.util is deprecated. Use logging.NullHandler instead.",
1308+
DeprecationWarning,
1309+
stacklevel=2,
1310+
)
1311+
super().__init__(level)
1312+
1313+
defemit(self,record:logging.LogRecord)->None:
12991314
pass

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp