-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign config such that defaults are visible in API
- Loading branch information
Showing
3 changed files
with
15 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
from dataclasses import dataclass | ||
import json | ||
|
||
|
||
@dataclass | ||
class Config: | ||
"""Configuration settings for the application.""" | ||
"""Configuration settings for the application. | ||
sigfigs_default = 2 | ||
decimal_places_default = 2 | ||
print_always_default = False | ||
Args: | ||
sigfigs (int): The number of significant figures to round to. | ||
decimal_places (int): The number of decimal places to round to. | ||
print_always (bool): Whether to print each result directly to the console. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
sigfigs=sigfigs_default, | ||
decimal_places=decimal_places_default, | ||
print_always=print_always_default, | ||
): | ||
self.sigfigs = sigfigs | ||
self.decimal_places = decimal_places | ||
self.print_always = print_always | ||
sigfigs: int | ||
decimal_places: int | ||
print_always: bool | ||
|
||
def to_json_str(self): | ||
return json.dumps(self.__dict__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters