Skip to content

Commit

Permalink
docs: fix outdated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
neithere committed Dec 30, 2023
1 parent 0f34a27 commit 684b4a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ enough; in these cases the powerful API of `argparse` is also available:

.. code-block:: python
@arg("text", default="hello world", nargs="+", help="The message")
def echo(text: str) -> None:
print text
@arg("words", default="hello world", nargs="+", help="The message")
def echo(words: list[str]) -> str:
return " ".join(words)
Please note that decorators will soon be fully replaced with annotations.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/subparsers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The equivalent code without `Argh` would be::
bar_parser.set_defaults(function=bar)

args = parser.parse_args()
print args.function(args)
print(args.function(args))

Now consider this expression::

Expand Down Expand Up @@ -54,7 +54,7 @@ to write something like this (generic argparse API)::
foo_quux_parser.set_defaults(function=quux)

args = parser.parse_args()
print args.function(args)
print(args.function(args))

.. note::

Expand Down
8 changes: 4 additions & 4 deletions src/argh/dispatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,13 @@ class EntryPoint:
app = EntryPoint("main", {"description": "This is a cool app"})
@app
def ls() -> None:
def ls() -> Iterator[int]:
for i in range(10):
print i
yield i
@app
def greet() -> None:
print "hello"
def greet() -> str:
return "hello"
if __name__ == "__main__":
app()
Expand Down

0 comments on commit 684b4a9

Please sign in to comment.