Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
+14
-19
@@ -100,7 +100,7 @@ LogScope = Literal["process", "global", "local"]
|
||||
|
||||
|
||||
def _should_log_with_scope(scope: LogScope) -> bool:
|
||||
"""Decide whether to log based on scope"""
|
||||
"""Decide whether to log based on scope."""
|
||||
if scope == "global":
|
||||
from vllm.distributed.parallel_state import is_global_first_rank
|
||||
|
||||
@@ -113,17 +113,16 @@ def _should_log_with_scope(scope: LogScope) -> bool:
|
||||
|
||||
|
||||
class _VllmLogger(Logger):
|
||||
"""
|
||||
Note:
|
||||
This class is just to provide type information.
|
||||
We actually patch the methods directly on the [`logging.Logger`][]
|
||||
instance to avoid conflicting with other libraries such as
|
||||
`intel_extension_for_pytorch.utils._logger`.
|
||||
"""Note:
|
||||
This class is just to provide type information.
|
||||
We actually patch the methods directly on the [`logging.Logger`][]
|
||||
instance to avoid conflicting with other libraries such as
|
||||
`intel_extension_for_pytorch.utils._logger`.
|
||||
|
||||
"""
|
||||
|
||||
def debug_once(self, msg: str, *args: Hashable, scope: LogScope = "local") -> None:
|
||||
"""
|
||||
As [`debug`][logging.Logger.debug], but subsequent calls with
|
||||
"""As [`debug`][logging.Logger.debug], but subsequent calls with
|
||||
the same message are silently dropped.
|
||||
"""
|
||||
if not _should_log_with_scope(scope):
|
||||
@@ -131,8 +130,7 @@ class _VllmLogger(Logger):
|
||||
_print_debug_once(self, msg, *args)
|
||||
|
||||
def info_once(self, msg: str, *args: Hashable, scope: LogScope = "local") -> None:
|
||||
"""
|
||||
As [`info`][logging.Logger.info], but subsequent calls with
|
||||
"""As [`info`][logging.Logger.info], but subsequent calls with
|
||||
the same message are silently dropped.
|
||||
"""
|
||||
if not _should_log_with_scope(scope):
|
||||
@@ -142,8 +140,7 @@ class _VllmLogger(Logger):
|
||||
def warning_once(
|
||||
self, msg: str, *args: Hashable, scope: LogScope = "local"
|
||||
) -> None:
|
||||
"""
|
||||
As [`warning`][logging.Logger.warning], but subsequent calls with
|
||||
"""As [`warning`][logging.Logger.warning], but subsequent calls with
|
||||
the same message are silently dropped.
|
||||
"""
|
||||
if not _should_log_with_scope(scope):
|
||||
@@ -151,8 +148,7 @@ class _VllmLogger(Logger):
|
||||
_print_warning_once(self, msg, *args)
|
||||
|
||||
def error_once(self, msg: str, *args: Hashable, scope: LogScope = "local") -> None:
|
||||
"""
|
||||
As [`error`][logging.Logger.error], but subsequent calls with
|
||||
"""As [`error`][logging.Logger.error], but subsequent calls with
|
||||
the same message are silently dropped.
|
||||
"""
|
||||
if not _should_log_with_scope(scope):
|
||||
@@ -220,8 +216,8 @@ def _configure_vllm_root_logger() -> None:
|
||||
def init_logger(name: str) -> _VllmLogger:
|
||||
"""The main purpose of this function is to ensure that loggers are
|
||||
retrieved in such a way that we can be sure the root vllm logger has
|
||||
already been configured."""
|
||||
|
||||
already been configured.
|
||||
"""
|
||||
logger = logging.getLogger(name)
|
||||
|
||||
for method_name, method in _METHODS_TO_PATCH.items():
|
||||
@@ -310,8 +306,7 @@ def _trace_calls(log_path, root_dir, frame, event, arg=None):
|
||||
|
||||
|
||||
def enable_trace_function_call(log_file_path: str, root_dir: str | None = None):
|
||||
"""
|
||||
Enable tracing of every function call in code under `root_dir`.
|
||||
"""Enable tracing of every function call in code under `root_dir`.
|
||||
This is useful for debugging hangs or crashes.
|
||||
`log_file_path` is the path to the log file.
|
||||
`root_dir` is the root directory of the code to trace. If None, it is the
|
||||
|
||||
Reference in New Issue
Block a user