rewrite to using argparse #2

Merged
bjornoka merged 3 commits from dev into main 2025-03-01 23:01:33 +01:00
Owner
No description provided.
bjornoka added 2 commits 2025-02-08 23:55:54 +01:00
oysteikt reviewed 2025-03-01 13:31:48 +01:00
@@ -99,0 +86,4 @@
parser.add_argument("-s", "--stop",
help="limit output to only the supplied stop place")
# No argument
Owner

The term usage is a bit confusing here, considering argument kinda already refers to a command line argument in this context. Maybe Requiring value and No value, or alternatively With value and Boolean flags would be better candidates for comments?

The term usage is a bit confusing here, considering `argument` kinda already refers to a command line argument in this context. Maybe `Requiring value` and `No value`, or alternatively `With value` and `Boolean flags` would be better candidates for comments?
@@ -156,0 +118,4 @@
deps = list(filter(lambda d: str(d.line) == args.bus, deps))
if args.to:
deps = list(filter(lambda d: d.towards_midtbyen, deps))
if args.__dict__["from"]: # from is a reserved keyword in python
Owner

Consider using

parser.add_argument(
  "-f",
  "--from",
  action="store_true",
  dest="from_",
  help="show only buses going away from town",
)

...

if args.from_:
  ...
Consider using ```python parser.add_argument( "-f", "--from", action="store_true", dest="from_", help="show only buses going away from town", ) ... if args.from_: ... ```
@@ -156,0 +119,4 @@
if args.to:
deps = list(filter(lambda d: d.towards_midtbyen, deps))
if args.__dict__["from"]: # from is a reserved keyword in python
deps = list(filter(lambda d: not d.towards_midtbyen, deps))
Owner

I see these are not really part of the change, but they could be a bit more readable if written as comprehensions

deps = [d for d in deps if not d.towards_midtbyen]
I see these are not really part of the change, but they could be a bit more readable if written as comprehensions ```python deps = [d for d in deps if not d.towards_midtbyen] ```
bjornoka force-pushed dev from 0656b7f2b1 to b756581e35 2025-03-01 22:56:49 +01:00 Compare
bjornoka changed title from WIP: rewrite to using argparse to rewrite to using argparse 2025-03-01 22:57:24 +01:00
bjornoka merged commit e6f97f3bad into main 2025-03-01 23:01:33 +01:00
bjornoka deleted branch dev 2025-03-01 23:01:33 +01:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Grzegorz/crystal-orb#2