Title: `open()` overloads mixes `typing.IO` and `io.IOBase` hierarchies · Issue #6076 · python/typeshed · GitHub
Open Graph Title: `open()` overloads mixes `typing.IO` and `io.IOBase` hierarchies · Issue #6076 · python/typeshed
X Title: `open()` overloads mixes `typing.IO` and `io.IOBase` hierarchies · Issue #6076 · python/typeshed
Description: Currently the overloads for the open builtin uses io.IOBase based types for specific cases (specifically io.{TextIOWrapper,FileIO,BufferedRandom,BufferedWriter,BufferedReader}), but for fallbacks it uses typing.IO based types (specifical...
Open Graph Description: Currently the overloads for the open builtin uses io.IOBase based types for specific cases (specifically io.{TextIOWrapper,FileIO,BufferedRandom,BufferedWriter,BufferedReader}), but for fallbacks i...
X Description: Currently the overloads for the open builtin uses io.IOBase based types for specific cases (specifically io.{TextIOWrapper,FileIO,BufferedRandom,BufferedWriter,BufferedReader}), but for fallbacks i...
Opengraph URL: https://github.com/python/typeshed/issues/6076
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`open()` overloads mixes `typing.IO` and `io.IOBase` hierarchies","articleBody":"Currently the overloads for the [`open` builtin](https://github.com/python/typeshed/blob/2217ac8/stdlib/builtins.pyi#L1164-L1249) uses `io.IOBase` based types for specific cases (specifically `io.{TextIOWrapper,FileIO,BufferedRandom,BufferedWriter,BufferedReader}`), but for fallbacks it uses `typing.IO` based types (specifically `typing.{BinaryIO,IO[Any]}`).\r\n\r\nThe same is the case for [`Path.open`](https://github.com/python/typeshed/blob/2217ac8/stdlib/pathlib.pyi#L89-L143) and [`Traversable.open`](https://github.com/python/typeshed/blob/2217ac8/stdlib/importlib/abc.pyi#L104-L163).\r\n\r\nThis would maybe not be a problem if the `io.IOBase` classes were considered subclasses, subtypes or implementations of `typing.IO`, but this is not the case. This can maybe be considered a problem on it's own, but it would still seem better to use a consistent approach for typing.\r\n\r\nThe practical problem that this causes is that functions that should deal with all result from open will have to accept both `typing.IO` and `io.IOBase`.\r\n\r\nWritten for commit 2217ac8, but can also be seen in typeshed included with mypy 0.910.","author":{"url":"https://github.com/aucampia","@type":"Person","name":"aucampia"},"datePublished":"2021-09-25T18:03:05Z","url":"https://github.com/python/typeshed/issues/6076"}
| 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:629eb974-03d5-4555-02d0-8362c238196b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DEDE:4D1C6:20B3ABF:2C74B47:6B0021D0 |
| html-safe-nonce | 4b32f9c85774a5837835b666352dad5ba942bdb4e7c9a1762509e080694bf391 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERURFOjREMUM2OjIwQjNBQkY6MkM3NEI0Nzo2QjAwMjFEMCIsInZpc2l0b3JfaWQiOiI3OTkzMzcyMzMzNjg5NTQ1MTY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6022f8416ff7c26ed66fc838aca4068093bcd5452a5b91170364d535f9dfff20 |
| hovercard-subject-tag | issue:1007158125 |
| 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/6076/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d9c05bbef793f93bf9bbeb71f67f8f95cf343ee09470beb4cfd36d041644c436/python/typeshed/issues/6076 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d9c05bbef793f93bf9bbeb71f67f8f95cf343ee09470beb4cfd36d041644c436/python/typeshed/issues/6076 |
| og:image:alt | Currently the overloads for the open builtin uses io.IOBase based types for specific cases (specifically io.{TextIOWrapper,FileIO,BufferedRandom,BufferedWriter,BufferedReader}), but for fallbacks i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aucampia |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width