[issue41592] Make _SubParsersAction public

2021-10-25 Thread paul j3
paul j3 added the comment: A _SubParsersAction is private to the extent that users should not attempt to create it directly, and thus don't need to know the details - beyond what's documented: "The add_subparsers() method is normally called with no arguments and returns a special action obj

[issue41592] Make _SubParsersAction public

2021-10-25 Thread Eric Pederson
Eric Pederson added the comment: But is _SubParsersAction really private if there are methods on it that are required to use (add_parser())? -- ___ Python tracker ___ ___

[issue41592] Make _SubParsersAction public

2021-10-25 Thread paul j3
paul j3 added the comment: `add_argument` also returns a Action subclass object. All of those subclasses are "private". While that return reference is usually ignored, sometimes it is useful to it, assigning it to a variable or list. The documentation could be clearer about access to Acti

[issue41592] Make _SubParsersAction public

2021-10-22 Thread Ken Jin
Ken Jin added the comment: > Where can I get their attention? I've nosied Raymond on this bug, he should be receiving our messages. -- ___ Python tracker ___ ___

[issue41592] Make _SubParsersAction public

2021-10-22 Thread Eric Pederson
Eric Pederson added the comment: Yes - that was the first thing I tried and why I logged the bug. I will log a bug with Pycharm but it still seems like the long term solution is to make _SubParsersAction public since it is used like a public object. I thought that logging the bug here woul

[issue41592] Make _SubParsersAction public

2021-10-22 Thread Ken Jin
Ken Jin added the comment: Closing this because this is a linter problem (inside PyCharm), not a Python problem. In the earlier message I provided a solution for PyCharm. PS, mypy --strict doesn't complain when I import _SubParsersAction, meaning most type checkers likely won't complain eith

[issue41592] Make _SubParsersAction public

2021-10-22 Thread Ken Jin
Ken Jin added the comment: Turning a class public or not requires a lot more discussion by the argparse maintainers (I'm definitely not one of them). Have you considered this workaround for PyCharm? from argparse import ( _SubParsersAction, # noqa ArgumentParser, ) -- nosy:

[issue41592] Make _SubParsersAction public

2021-10-21 Thread Irit Katriel
Change by Irit Katriel : -- nosy: +kj ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org

[issue41592] Make _SubParsersAction public

2020-08-19 Thread Eric Pederson
New submission from Eric Pederson : ArgumentParser.add_subparsers() returns a _SubParsersAction. This requires user code using type annotations to use a protected type which causes type checkers like PyCharm to complain. For example: def add_subparser(name: str, subparser: _SubParsersAction