Skip to content

Commit

Permalink
inconsequential refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dwreeves committed Dec 29, 2023
1 parent c4b6ea1 commit 2054fbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/rich_click/rich_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ def __init__(

self.console = rich_console

if rich_help_config is None and hasattr(parent, "help_config"):
self.help_config = parent.help_config # type: ignore[has-type,union-attr]
if rich_help_config is None:
if hasattr(parent, "help_config"):
self.help_config = parent.help_config # type: ignore[has-type,union-attr]
else:
self.help_config = RichHelpConfiguration.load_from_globals()
elif isinstance(rich_help_config, Mapping):
if hasattr(parent, "help_config"):
if TYPE_CHECKING:
Expand All @@ -48,8 +51,6 @@ def __init__(
self.help_config = RichHelpConfiguration(**kw)
else:
self.help_config = RichHelpConfiguration.load_from_globals(**rich_help_config)
elif rich_help_config is None:
self.help_config = RichHelpConfiguration.load_from_globals()
else:
self.help_config = rich_help_config

Expand Down
6 changes: 1 addition & 5 deletions src/rich_click/rich_help_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dataclasses import dataclass, field
from os import getenv
from types import ModuleType
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, TypeVar, Union
from typing import Any, Dict, List, Optional, Tuple, TypeVar, Union

import rich.align
import rich.highlighter
Expand All @@ -14,10 +14,6 @@
from rich_click.utils import truthy


if TYPE_CHECKING:
pass


T = TypeVar("T", bound="RichHelpConfiguration")


Expand Down

0 comments on commit 2054fbf

Please sign in to comment.