Skip to content

Commit

Permalink
chore: silence irrelevant linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
serhez committed Apr 15, 2024
1 parent 46752f1 commit 98bfb83
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion mloggers/_log_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from numpy import inf


class LogLevel(Enum):
class LogLevel(Enum): # type:ignore[reportGeneralTypeIssues]
"""
The available log levels.
Each level is associated with a color and an importance level.
Expand Down
2 changes: 1 addition & 1 deletion mloggers/console_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class ConsoleLogger(Logger):
"""Logs to the console (i.e., standard I/O)."""

def __init__(self, default_level: LogLevel = LogLevel.INFO):
def __init__(self, default_level: LogLevel = LogLevel.INFO): # type:ignore[reportArgumentType]
super().__init__(default_level)

def log(
Expand Down
2 changes: 1 addition & 1 deletion mloggers/file_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class FileLogger(Logger):
"""Logs to a file."""

def __init__(self, file_path: str, default_level: LogLevel | int = LogLevel.INFO):
def __init__(self, file_path: str, default_level: LogLevel | int = LogLevel.INFO): # type:ignore[reportArgumentType]
"""
Initializes a file logger.
Expand Down
12 changes: 6 additions & 6 deletions mloggers/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

# This constant is used to assign an importance level to anything not using the LogLevel enum.
# It was chosen to be the same as LogLevel.INFO, but it can be changed to any other value.
DEFAULT_IMPORTANCE = LogLevel.INFO.value["level"]
DEFAULT_IMPORTANCE = LogLevel.INFO.value["level"] # type:ignore[reportAttributeAccessIssue]


class Logger(ABC):
"""The abstract class for a logger."""

def __init__(self, default_level: LogLevel | int = LogLevel.INFO):
def __init__(self, default_level: LogLevel | int = LogLevel.INFO): # type:ignore[reportArgumentType]
"""
Initialize the logger.
Expand Down Expand Up @@ -107,7 +107,7 @@ def info(
- You can provide None dictionary values to mean that the key is a header or title of the message.
"""

self.log(message, LogLevel.INFO, *args, **kwargs)
self.log(message, LogLevel.INFO, *args, **kwargs) # type:ignore[reportArgumentType]

def warn(
self,
Expand All @@ -127,7 +127,7 @@ def warn(
- You can provide None dictionary values to mean that the key is a header or title of the message.
"""

self.log(message, LogLevel.WARN, *args, **kwargs)
self.log(message, LogLevel.WARN, *args, **kwargs) # type:ignore[reportArgumentType]

# Alias warning to warn
warning = warn
Expand All @@ -150,7 +150,7 @@ def error(
- You can provide None dictionary values to mean that the key is a header or title of the message.
"""

self.log(message, LogLevel.ERROR, *args, **kwargs)
self.log(message, LogLevel.ERROR, *args, **kwargs) # type:ignore[reportArgumentType]

def debug(
self,
Expand All @@ -170,4 +170,4 @@ def debug(
- You can provide None dictionary values to mean that the key is a header or title of the message.
"""

self.log(message, LogLevel.DEBUG, *args, **kwargs)
self.log(message, LogLevel.DEBUG, *args, **kwargs) # type:ignore[reportArgumentType]
10 changes: 5 additions & 5 deletions mloggers/multi_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(
self,
loggers: list[Logger],
default_mask: list[type[Logger]] = [],
default_level: LogLevel | int = LogLevel.INFO,
default_level: LogLevel | int = LogLevel.INFO, # type:ignore[reportArgumentType]
):
"""
Initializes a multi-logger.
Expand Down Expand Up @@ -108,7 +108,7 @@ def info(
- If None, the default mask will be used.
"""

self.log(message, LogLevel.INFO, mask, *args, **kwargs)
self.log(message, LogLevel.INFO, mask, *args, **kwargs) # type:ignore[reportArgumentType]

def warn(
self,
Expand All @@ -131,7 +131,7 @@ def warn(
- If None, the default mask will be used.
"""

self.log(message, LogLevel.WARN, mask, *args, **kwargs)
self.log(message, LogLevel.WARN, mask, *args, **kwargs) # type:ignore[reportArgumentType]

# Alias warning to warn
warning = warn
Expand All @@ -157,7 +157,7 @@ def error(
- If None, the default mask will be used.
"""

self.log(message, LogLevel.ERROR, mask, *args, **kwargs)
self.log(message, LogLevel.ERROR, mask, *args, **kwargs) # type:ignore[reportArgumentType]

def debug(
self,
Expand All @@ -180,4 +180,4 @@ def debug(
- If None, the default mask will be used.
"""

self.log(message, LogLevel.DEBUG, mask, *args, **kwargs)
self.log(message, LogLevel.DEBUG, mask, *args, **kwargs) # type:ignore[reportArgumentType]
2 changes: 1 addition & 1 deletion mloggers/wandb_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(
project: str,
group: str,
experiment: str,
default_level: LogLevel | int = LogLevel.INFO,
default_level: LogLevel | int = LogLevel.INFO, # type:ignore[reportArgumentType]
config: DictConfig | None = None,
):
"""
Expand Down

0 comments on commit 98bfb83

Please sign in to comment.