Title: BinaryIO does not have peek method · Issue #3951 · python/typeshed · GitHub
Open Graph Title: BinaryIO does not have peek method · Issue #3951 · python/typeshed
X Title: BinaryIO does not have peek method · Issue #3951 · python/typeshed
Description: When opening a file with binary mode, typing.BinaryIO is inferred. This type should have the https://docs.python.org/3/library/io.html#io.BufferedReader.peek method. It looks like this is known, judging by the TODO on this line in the ty...
Open Graph Description: When opening a file with binary mode, typing.BinaryIO is inferred. This type should have the https://docs.python.org/3/library/io.html#io.BufferedReader.peek method. It looks like this is known, ju...
X Description: When opening a file with binary mode, typing.BinaryIO is inferred. This type should have the https://docs.python.org/3/library/io.html#io.BufferedReader.peek method. It looks like this is known, ju...
Opengraph URL: https://github.com/python/typeshed/issues/3951
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BinaryIO does not have peek method","articleBody":"When opening a file with binary mode, `typing.BinaryIO` is inferred.\r\nThis type should have the [https://docs.python.org/3/library/io.html#io.BufferedReader.peek](`peek`) method.\r\nIt looks like this is known, judging by the TODO on this line in the `typing.pyi` stub: \r\nhttps://github.com/python/typeshed/blob/bc90043e546f3d242e0f2a276194d77ba9811781/stdlib/3/typing.pyi#L509\r\n(There are also other `TODO`s there for BinaryIO - if those should be added, I could of course do those in the same change if that's not a problem.)\r\n\r\nA reproducible example:\r\n```python\r\nwith open(\"some-file\", 'rb') as f:\r\n f.peek()\r\n```\r\n\r\nRunning mypy on this results in `error: \"BinaryIO\" has no attribute \"peek\"`.\r\n\r\nThis issue has also [been reported earlier in mypy](https://github.com/python/mypy/issues/8433).\r\n\r\nI'd be glad to submit a PR for this. Is it as simple as adding `peek` to `BinaryIO` in `typing.pyi`? Or should there also be tests for these changes?","author":{"url":"https://github.com/vegarsti","@type":"Person","name":"vegarsti"},"datePublished":"2020-04-29T06:42:44Z","url":"https://github.com/python/typeshed/issues/3951"}
| 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:f3abfb96-28df-b9de-21f6-96594a4dad66 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 81D8:15E5F9:1F31C38:2A62A91:6B001A93 |
| html-safe-nonce | 15612e4514ca429b95ad6e8f8f9edece9e3ef6c7e86eaa65e24394853d5bb55e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUQ4OjE1RTVGOToxRjMxQzM4OjJBNjJBOTE6NkIwMDFBOTMiLCJ2aXNpdG9yX2lkIjoiNzY2MDAwNzU1OTI2ODQwNzk1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d86428431973a8297660ff8438e3e7a7be51e03c2f68416cb8912727e6051ca5 |
| hovercard-subject-tag | issue:608816812 |
| 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/typeshed/3951/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de0854ae657650e0ede3fa920dc55fc2f46d05da44bcb7d949184773660187b9/python/typeshed/issues/3951 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de0854ae657650e0ede3fa920dc55fc2f46d05da44bcb7d949184773660187b9/python/typeshed/issues/3951 |
| og:image:alt | When opening a file with binary mode, typing.BinaryIO is inferred. This type should have the https://docs.python.org/3/library/io.html#io.BufferedReader.peek method. It looks like this is known, ju... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vegarsti |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width