Skip to content

Commit

Permalink
✨ Set Detector/Printer attributes before __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
michprev committed Oct 26, 2023
1 parent cf33425 commit f7a357e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion woke/cli/print.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def _callback(*args, **kwargs):
command.callback = _callback

try:
instance = cls()
instance = object.__new__(cls)
instance.build = build
instance.build_info = build_info
instance.config = config
Expand All @@ -344,6 +344,7 @@ def _callback(*args, **kwargs):
compiler.latest_graph.copy()
)
instance.logger = get_logger(cls.__name__)
instance.__init__()

sub_ctx = command.make_context(
command.name,
Expand Down
3 changes: 2 additions & 1 deletion woke/detectors/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _callback(*args, **kwargs): # pyright: ignore reportGeneralTypeIssues
command.callback = _callback

try:
instance = cls()
instance = object.__new__(cls)
instance.build = build
instance.build_info = build_info
instance.config = config
Expand All @@ -312,6 +312,7 @@ def _callback(*args, **kwargs): # pyright: ignore reportGeneralTypeIssues
instance.logger = get_logger(cls.__name__)
if logging_handler is not None:
instance.logger.addHandler(logging_handler)
instance.__init__()

sub_ctx = command.make_context(
command.name,
Expand Down

0 comments on commit f7a357e

Please sign in to comment.