Skip to content

Commit

Permalink
reformat config.py
Browse files Browse the repository at this point in the history
  • Loading branch information
djcopley committed Apr 6, 2024
1 parent be5e957 commit 42af3c2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/shelloracle/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections.abc import Mapping, Iterator
from pathlib import Path
from typing import Any

from yaspin.spinners import SPINNERS_DATA

if sys.version_info < (3, 11):
Expand All @@ -18,11 +19,8 @@


class Configuration(Mapping):
"""ShellOracle application configuration
"""ShellOracle application configuration"""

The configuration is loaded at program startup, and persisted for the life of the application. Any changes made
to the configuration while the application is running, will have no effect.
"""
if "SHELLORACLE_CONFIG" in os.environ:
filepath = Path(os.environ["SHELLORACLE_CONFIG"]).absolute()
else:
Expand All @@ -41,6 +39,12 @@ def __len__(self) -> int:
def __iter__(self) -> Iterator[Any]:
return iter(self._config)

def __str__(self):
return f"Configuration({self._config})"

def __repr__(self) -> str:
return str(self)

@property
def provider(self) -> str:
return self["shelloracle"]["provider"]
Expand Down

0 comments on commit 42af3c2

Please sign in to comment.