Title: argparse.BooleanOptionalAction accepts and silently discards choices, metavar, and type arguments · Issue #92248 · python/cpython · GitHub
Open Graph Title: argparse.BooleanOptionalAction accepts and silently discards choices, metavar, and type arguments · Issue #92248 · python/cpython
X Title: argparse.BooleanOptionalAction accepts and silently discards choices, metavar, and type arguments · Issue #92248 · python/cpython
Description: This is an elaboration of issue #85039. >>> parser = ArgumentParser() >>> parser.add_argument('--foo', action=BooleanOptionalAction, ... choices=[1,2], metavar='FOOBAR', type=int) # doctest: +ELLIPSIS BooleanOptionalAction(...) Note that...
Open Graph Description: This is an elaboration of issue #85039. >>> parser = ArgumentParser() >>> parser.add_argument('--foo', action=BooleanOptionalAction, ... choices=[1,2], metavar='FOOBAR', type=int) # doctest: +ELLIP...
X Description: This is an elaboration of issue #85039. >>> parser = ArgumentParser() >>> parser.add_argument('--foo', action=BooleanOptionalAction, ... choices=[1,2], metavar='FOOBAR...
Opengraph URL: https://github.com/python/cpython/issues/92248
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"argparse.BooleanOptionalAction accepts and silently discards choices, metavar, and type arguments","articleBody":"This is an elaboration of issue #85039.\r\n\r\n \u003e\u003e\u003e parser = ArgumentParser()\r\n \u003e\u003e\u003e parser.add_argument('--foo', action=BooleanOptionalAction,\r\n ... choices=[1,2], metavar='FOOBAR', type=int) # doctest: +ELLIPSIS\r\n BooleanOptionalAction(...)\r\n\r\nNote that the store_const, store_true, and store_false actions disallow those keyword arguments.\r\n\r\n \u003e\u003e\u003e parser.add_argument('--bar', action='store_true', choices=[1,2])\r\n Traceback (most recent call last):\r\n ...\r\n TypeError: __init__() got an unexpected keyword argument 'choices'\r\n \u003e\u003e\u003e parser.add_argument('--bar', action='store_true', metavar='FOOBAR')\r\n Traceback (most recent call last):\r\n ...\r\n TypeError: __init__() got an unexpected keyword argument 'metavar'\r\n \u003e\u003e\u003e parser.add_argument('--bar', action='store_true', type=int)\r\n Traceback (most recent call last):\r\n ...\r\n TypeError: __init__() got an unexpected keyword argument 'type'\r\n \u003e\u003e\u003e parser.add_argument('--bar', action='store_true') # doctest: +ELLIPSIS\r\n _StoreTrueAction(...)\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103678\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/samwyse","@type":"Person","name":"samwyse"},"datePublished":"2022-05-03T18:25:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/92248/cpython/issues/92248"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b4686893-ddd6-0600-a8d0-942f7babfcc5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E5B2:15A631:DFFA72:132FB31:6969F1F1 |
| html-safe-nonce | c9f8fc69d61583205df8e77b55e9c745289c79b52b0dd4fc6296965c7b29b4fc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNUIyOjE1QTYzMTpERkZBNzI6MTMyRkIzMTo2OTY5RjFGMSIsInZpc2l0b3JfaWQiOiI3OTM1NzExMzc1NTExOTA4ODQ5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 03ec45dbd00c602e92956459ba8b98197eec82a707d8050c97bfcca341c68260 |
| hovercard-subject-tag | issue:1224455925 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/92248/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9acdb9c70ea5c43ddea12bc8ab53068cd2e547535ed65cce95c15347e8071ea3/python/cpython/issues/92248 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9acdb9c70ea5c43ddea12bc8ab53068cd2e547535ed65cce95c15347e8071ea3/python/cpython/issues/92248 |
| og:image:alt | This is an elaboration of issue #85039. >>> parser = ArgumentParser() >>> parser.add_argument('--foo', action=BooleanOptionalAction, ... choices=[1,2], metavar='FOOBAR', type=int) # doctest: +ELLIP... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | samwyse |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width