Title: Only plain literals should be parsed · Issue #97 · google/python-fire · GitHub
Open Graph Title: Only plain literals should be parsed · Issue #97 · google/python-fire
X Title: Only plain literals should be parsed · Issue #97 · google/python-fire
Description: @dbieber correctly pointed out in #95 that there is a more general problem with the parsing code. This is a follow up issue to that issue which only dealt with the most common case of a single argument. Here are some cases demonstrating ...
Open Graph Description: @dbieber correctly pointed out in #95 that there is a more general problem with the parsing code. This is a follow up issue to that issue which only dealt with the most common case of a single argu...
X Description: @dbieber correctly pointed out in #95 that there is a more general problem with the parsing code. This is a follow up issue to that issue which only dealt with the most common case of a single argu...
Opengraph URL: https://github.com/google/python-fire/issues/97
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Only plain literals should be parsed","articleBody":"@dbieber correctly pointed out in #95 that there is a more general problem with the parsing code. This is a follow up issue to that issue which only dealt with the most common case of a single argument.\r\n\r\nHere are some cases demonstrating\r\n```bash\r\n$ python3 -c \"import fire.parser as p; v = p.DefaultParseValue('[1+1]'); print(type(v), v)\"\r\n\u003cclass 'list'> [2]\r\n$ python3 -c \"import fire.parser as p; v = p.DefaultParseValue('{key: 1+1}'); print(type(v), v)\"\r\n\u003cclass 'dict'> {'key': 2} \r\n```\r\n\r\nSome options are:\r\n1. Accept the existing behaviour.\r\n2. Always parse the whole argument as a string by doing `raise ValueError` in ``fire.parser._LiteralEval`\r\n3. Parse only the sub expressions as strings\r\n\r\nFor 2. and 3. I think these would be the valid types from the `ast` module. \r\n\r\n - `Str`\r\n - `Name` (converted to `Str`)\r\n - `Num`\r\n - `List`\r\n - `Tuple`\r\n - `Dict`\r\n - `Set`\r\n - `UnaryOp`","author":{"url":"https://github.com/mbarkhau","@type":"Person","name":"mbarkhau"},"datePublished":"2017-10-12T06:00:27Z","url":"https://github.com/google/python-fire/issues/97"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:3804e681-93aa-42ee-7f90-3f8266af5b6d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C218:184B81:2E81A93:3D838A0:6B0027C1 |
| html-safe-nonce | 2fbca255fea270779fb0f56faa9c59953a6a41882f430333c433f4a893196d0b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjE4OjE4NEI4MToyRTgxQTkzOjNEODM4QTA6NkIwMDI3QzEiLCJ2aXNpdG9yX2lkIjoiNjYxNjU3ODIwOTk4OTI3MzUzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1f785fcbaea0e6eb0cf5ae2b20c896fda5e778522814c60f2c79f457cae5d55f |
| hovercard-subject-tag | issue:264822730 |
| 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/google/python-fire/97/issue_layout |
| twitter:image | https://opengraph.githubassets.com/09e5117d9363b29461d8f26fc5eae043d6313b60ef67fcc102d305604fc8c368/google/python-fire/issues/97 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/09e5117d9363b29461d8f26fc5eae043d6313b60ef67fcc102d305604fc8c368/google/python-fire/issues/97 |
| og:image:alt | @dbieber correctly pointed out in #95 that there is a more general problem with the parsing code. This is a follow up issue to that issue which only dealt with the most common case of a single argu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mbarkhau |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/google/python-fire git https://github.com/google/python-fire.git |
| octolytics-dimension-user_id | 1342004 |
| octolytics-dimension-user_login | |
| octolytics-dimension-repository_id | 82729529 |
| octolytics-dimension-repository_nwo | google/python-fire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 82729529 |
| octolytics-dimension-repository_network_root_nwo | google/python-fire |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width