Title: Can not tabulate row with a field that looks like a Python Bool using maxcolwidths · Issue #305 · astanin/python-tabulate · GitHub
Open Graph Title: Can not tabulate row with a field that looks like a Python Bool using maxcolwidths · Issue #305 · astanin/python-tabulate
X Title: Can not tabulate row with a field that looks like a Python Bool using maxcolwidths · Issue #305 · astanin/python-tabulate
Description: The following line will fail with an error about "bool' object has no attribute 'expandtabs' tabulate.tabulate([['init','True']], maxcolwidths=[None, 42]) This happens because the _wrap_text_to_col_widths method casts the cell to a caste...
Open Graph Description: The following line will fail with an error about "bool' object has no attribute 'expandtabs' tabulate.tabulate([['init','True']], maxcolwidths=[None, 42]) This happens because the _wrap_text_to_col...
X Description: The following line will fail with an error about "bool' object has no attribute 'expandtabs' tabulate.tabulate([['init','True']], maxcolwidths=[None, 42]) This happ...
Opengraph URL: https://github.com/astanin/python-tabulate/issues/305
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can not tabulate row with a field that looks like a Python Bool using maxcolwidths","articleBody":"The following line will fail with an error about \"bool' object has no attribute 'expandtabs'\r\n\r\n tabulate.tabulate([['init','True']], maxcolwidths=[None, 42])\r\n\r\nThis happens because the _wrap_text_to_col_widths method casts the cell to a casted cell by calling _type(cell, numpars)(cell) which will convert the string 'True' into a bool. Unfortunately the wrapper.wrap method called immediately after expects a str according to it's docstring and so explodes when passed a bool\r\n\r\nMy quick naïve reading suggests you could remove the entire if/else clause for casted_cell and just set casted cell equal to str(cell); if your next call only accepts a str why cast to anything else? Still I'll leave it to those that know the code better then ignorant me to figure out the best fix.\r\n\r\nAlso completely random nitpick, but I noticed the _type method docstring lists other types it will convert, but does not include bool in it's description despite checking for and handling bools so may want to update that for consistency.","author":{"url":"https://github.com/dsollenberger","@type":"Person","name":"dsollenberger"},"datePublished":"2023-12-27T20:41:33Z","url":"https://github.com/astanin/python-tabulate/issues/305"}
| 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:1d6de436-3f39-43d3-47ba-ccaebcd51db9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D16E:9E1B2:1E876A:EF86E:6AFF4DB4 |
| html-safe-nonce | d748f3804a74c1776150183482948342cdea360b3588bb9990e4de0274929a9c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTZFOjlFMUIyOjFFODc2QTpFRjg2RTo2QUZGNERCNCIsInZpc2l0b3JfaWQiOiIyODE2NTU1MDg4NjYxMjUyMzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1ea483455589c1c580ee80ecb033c0cd67184dc0fc74d7794eefaffb936a3ca6 |
| hovercard-subject-tag | issue:2057758874 |
| 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/astanin/python-tabulate/305/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e5958a7daa9749c241c0df8f9c7f42c4abbaa5e9c8cafa671ce2b5650587b89f/astanin/python-tabulate/issues/305 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e5958a7daa9749c241c0df8f9c7f42c4abbaa5e9c8cafa671ce2b5650587b89f/astanin/python-tabulate/issues/305 |
| og:image:alt | The following line will fail with an error about "bool' object has no attribute 'expandtabs' tabulate.tabulate([['init','True']], maxcolwidths=[None, 42]) This happens because the _wrap_text_to_col... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dsollenberger |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6672a281260b126053da5da19a6127ba7804ee26f255c9b12ad124a822a55cd0 |
| turbo-cache-control | no-preview |
| go-import | github.com/astanin/python-tabulate git https://github.com/astanin/python-tabulate.git |
| octolytics-dimension-user_id | 71802 |
| octolytics-dimension-user_login | astanin |
| octolytics-dimension-repository_id | 205875548 |
| octolytics-dimension-repository_nwo | astanin/python-tabulate |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 205875548 |
| octolytics-dimension-repository_network_root_nwo | astanin/python-tabulate |
| 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 | 28805d6cf6280f5e10f2a6624504c872d9633a0f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width