ethereum/trinity

Strongly typed version of `argparse.Namespace` for use with `BootInfo.args`

pipermerriam opened this issue · 0 comments

What is wrong?

From: #2078 (comment)

BootInfo.args is of type argparse.Namespace which is effectively like an Any type.

How can it be fixed

Try creating our own subclass with type hints:

class TrinityArgs(argparse.Namespace):
    sync_mode: str
    port: int
    ...

This would allow us to have a strongly typed class to use for the result of CLI argument parsing and thus have slightly more robust type checking when interacting with it.