Skip to content

Commit

Permalink
add warnings control to Settings object
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Feb 18, 2025
1 parent 33a2846 commit 8a3ba67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vyper/cli/vyper_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ def _parse_args(argv):
if args.enable_decimals:
settings.enable_decimals = args.enable_decimals

if args.warnings_control:
settings.warnings_control = args.warnings_control

if args.verbose:
print(f"cli specified: `{settings}`", file=sys.stderr)

Expand Down
5 changes: 5 additions & 0 deletions vyper/compiler/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Settings:
experimental_codegen: Optional[bool] = None
debug: Optional[bool] = None
enable_decimals: Optional[bool] = None
warnings_control: Optional[str] = None

def __post_init__(self):
# sanity check inputs
Expand All @@ -65,6 +66,8 @@ def __post_init__(self):
assert isinstance(self.debug, bool)
if self.enable_decimals is not None:
assert isinstance(self.enable_decimals, bool)
if self.warnings_control is not None:
assert isinstance(self.warnings_control, str)

# CMC 2024-04-10 consider hiding the `enable_decimals` member altogether
def get_enable_decimals(self) -> bool:
Expand All @@ -84,6 +87,8 @@ def as_cli(self):
ret.append(" --debug")
if self.enable_decimals is True:
ret.append(" --enable-decimals")
if self.warnings_control is not None:
ret.append(" -W" + self.warnings_control)

return "".join(ret)

Expand Down

0 comments on commit 8a3ba67

Please sign in to comment.