Skip to content

Commit

Permalink
- Minor fix to readme.
Browse files Browse the repository at this point in the history
- Improve the writing of some messages.
  • Loading branch information
mauvilsa committed Jul 20, 2023
1 parent 661a0e7 commit 26c6e3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,7 @@ create a parser object and then add arguments to it. A simple example would be:
from jsonargparse import ArgumentParser

parser = ArgumentParser(prog="app", description="Description for my app.")

parser.add_argument("--opt1", type=int, default=0, help="Help for option 1.")

parser.add_argument("--opt2", type=float, default=1.0, help="Help for option 2.")


Expand Down
8 changes: 4 additions & 4 deletions jsonargparse/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ def default_config_files(self, default_config_files: Optional[List[Union[str, os
):
self._default_config_files = [os.fspath(d) for d in default_config_files]
else:
raise ValueError("default_config_files has to be None or List[str | os.PathLike].")
raise ValueError("default_config_files expects None or List[str | os.PathLike].")

if len(self._default_config_files) > 0:
if not hasattr(self, "_default_config_files_group"):
Expand Down Expand Up @@ -1364,7 +1364,7 @@ def default_env(self, default_env: bool):
elif isinstance(default_env, bool):
self._default_env = default_env
else:
raise ValueError("default_env has to be a boolean.")
raise ValueError("default_env expects a boolean.")
if self._subcommands_action:
for subparser in self._subcommands_action._name_parser_map.values():
subparser.default_env = self._default_env
Expand All @@ -1386,7 +1386,7 @@ def default_meta(self, default_meta: bool):
if isinstance(default_meta, bool):
self._default_meta = default_meta
else:
raise ValueError("default_meta has to be a boolean.")
raise ValueError("default_meta expects a boolean.")

@property
def env_prefix(self) -> Union[bool, str]:
Expand All @@ -1413,7 +1413,7 @@ def env_prefix(self, env_prefix: Union[bool, str]):
elif env_prefix is True:
env_prefix = os.path.splitext(self.prog)[0]
elif not isinstance(env_prefix, (bool, str)):
raise ValueError("env_prefix must be a string or a boolean.")
raise ValueError("env_prefix expects a string or a boolean.")
self._env_prefix = env_prefix

@property
Expand Down

0 comments on commit 26c6e3e

Please sign in to comment.