Title: "Not Subscriptable" Error in a very simple wrapper for numpy.float64 that simply converts it to float: · Issue #11 · eevee/camel · GitHub
Open Graph Title: "Not Subscriptable" Error in a very simple wrapper for numpy.float64 that simply converts it to float: · Issue #11 · eevee/camel
X Title: "Not Subscriptable" Error in a very simple wrapper for numpy.float64 that simply converts it to float: · Issue #11 · eevee/camel
Description: "Not Subscriptable" Error in a very simple wrapper for numpy.float64 that simply converts it to float: Hi there, All I am doing is this: @registry.loader('np_float64_mine', version=1) def _load_np_float64(obj, version, **kwargs): return ...
Open Graph Description: "Not Subscriptable" Error in a very simple wrapper for numpy.float64 that simply converts it to float: Hi there, All I am doing is this: @registry.loader('np_float64_mine', version=1) def _load_np_...
X Description: "Not Subscriptable" Error in a very simple wrapper for numpy.float64 that simply converts it to float: Hi there, All I am doing is this: @registry.loader('np_float64_mine', versio...
Opengraph URL: https://github.com/eevee/camel/issues/11
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Not Subscriptable\" Error in a very simple wrapper for numpy.float64 that simply converts it to float:","articleBody":"\"Not Subscriptable\" Error in a very simple wrapper for numpy.float64 that simply converts it to float:\r\n\r\n\r\nHi there, \r\n\r\nAll I am doing is this:\r\n\r\n @registry.loader('np_float64_mine', version=1)\r\n def _load_np_float64(obj, version, **kwargs):\r\n return np.float64(obj)\r\n\r\n\r\nBut, I get this strange error. \r\n\r\n\r\nresolvers = self.yaml._implicit_resolvers.get(value[0],[])\r\nTypeError: 'float' object is not subscriptable\r\n\r\n\r\n\r\nThings work great for many more complex things, like np.ndarray, etc.\r\nBut, for some reason, it's trying to take the length of singletons(?) like np.float64.\r\n\r\nIf I am doing something stupid, I apologizie, and would appreciate if you'd point me in the right direction.\r\n\r\nBelow, for reference, is a full MRE of the error.\r\n\r\n----\r\n\r\n\r\n\r\nimport camel\r\n\r\ntry:\r\n import numpy as np\r\n _have_numpy = True\r\nexcept Exception:\r\n have_numpy = False\r\n warnings.warn(\"Numpy not found. Won't provide numpy-related methods.\")\r\n\r\nfrom camel import Camel, CamelRegistry\r\nregistry = CamelRegistry()\r\n\r\n\r\n\r\nif _have_numpy:\r\n \r\n ## THIS DUMP IS WHERE THE ERROR LIES. \r\n @registry.dumper(np.float64, 'np_float64_mine', version=1)\r\n def _dump_np_float64(obj, **kwargs):\r\n return float(obj)\r\n\r\n @registry.loader('np_float64_mine', version=1)\r\n def _load_np_float64(obj, version, **kwargs):\r\n return np.float64(obj)\r\n\r\n\r\n ## everything else, works great, example, this - \r\n @registry.dumper(np.ndarray, 'np_ndarray_mine', version=1)\r\n def _dump_np_ndarray(obj, **kwargs):\r\n return([ str(obj.dtype), obj.tolist() ] )\r\n\r\n @registry.loader('np_ndarray_mine', version=1)\r\n def _load_np_ndarray(obj, version, **kwargs):\r\n (strdtype, obj)=obj\r\n return np.asarray(obj, dtype=strdtype)\r\n\r\n\r\n\r\ndef _test(item):\r\n print(\"ORIGINAL ITEM and its type:\")\r\n print(item)\r\n print(f\"{type(item)=}\")\r\n dumped = dumps(item)\r\n print(\"DUMPED ITEM:\")\r\n print(dumped)\r\n print(\"original item followed by LOAD OF DUMPED ITEM:\")\r\n print(item)\r\n print(loads(dumped))\r\n print(\"=================================================================================================\")\r\n\r\n\r\ndef _tests():\r\n _test(np.float64(345)\r\n\r\n\r\n","author":{"url":"https://github.com/deego","@type":"Person","name":"deego"},"datePublished":"2022-09-05T19:50:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/11/camel/issues/11"}
| 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:5b95a1af-6405-68a0-e6eb-efef48227e60 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E420:A1401:16D719D:1D2339A:698BE506 |
| html-safe-nonce | 542a2431524b3e9ba5e525fdc276b8f7605e643b9c531e0ebc861a4154e28c51 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDIwOkExNDAxOjE2RDcxOUQ6MUQyMzM5QTo2OThCRTUwNiIsInZpc2l0b3JfaWQiOiIxODQ5OTMyMDEzNDcwNzM3NjcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 530a009db3c3af4003a3bb78e3c4d24c0cf07a2cbc646c326f3f3d45b69bff67 |
| hovercard-subject-tag | issue:1362421642 |
| 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/eevee/camel/11/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3a44627ae4cca7e4ef921e3ad1eff3c662215474d8466a6d0ed2986a34c657f9/eevee/camel/issues/11 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3a44627ae4cca7e4ef921e3ad1eff3c662215474d8466a6d0ed2986a34c657f9/eevee/camel/issues/11 |
| og:image:alt | "Not Subscriptable" Error in a very simple wrapper for numpy.float64 that simply converts it to float: Hi there, All I am doing is this: @registry.loader('np_float64_mine', version=1) def _load_np_... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | deego |
| hostname | github.com |
| expected-hostname | github.com |
| None | 640eeb7b6ff4d8d106235d228c0c286e82592d4d2403227b5b2b4fc5832297a4 |
| turbo-cache-control | no-preview |
| go-import | github.com/eevee/camel git https://github.com/eevee/camel.git |
| octolytics-dimension-user_id | 94112 |
| octolytics-dimension-user_login | eevee |
| octolytics-dimension-repository_id | 44578650 |
| octolytics-dimension-repository_nwo | eevee/camel |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 44578650 |
| octolytics-dimension-repository_network_root_nwo | eevee/camel |
| 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 | 3d444f0a47beeeac94cddbb51c91ab408befe8d4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width