Title: HTTPResponse is not recognized as a subtype of typing.IO · Issue #2189 · python/typeshed · GitHub
Open Graph Title: HTTPResponse is not recognized as a subtype of typing.IO · Issue #2189 · python/typeshed
X Title: HTTPResponse is not recognized as a subtype of typing.IO · Issue #2189 · python/typeshed
Description: Copied from python/mypy#3108 From SO: request = urllib.request.Request(get_file_url, headers=self.data_api_headers) with urllib.request.urlopen(request) as response: with open(export_file_path, 'wb') as out_file: shutil.copyfileobj(respo...
Open Graph Description: Copied from python/mypy#3108 From SO: request = urllib.request.Request(get_file_url, headers=self.data_api_headers) with urllib.request.urlopen(request) as response: with open(export_file_path, 'wb...
X Description: Copied from python/mypy#3108 From SO: request = urllib.request.Request(get_file_url, headers=self.data_api_headers) with urllib.request.urlopen(request) as response: with open(export_file_path, ...
Opengraph URL: https://github.com/python/typeshed/issues/2189
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"HTTPResponse is not recognized as a subtype of typing.IO ","articleBody":"Copied from https://github.com/python/mypy/issues/3108\r\n\r\nFrom [SO](https://stackoverflow.com/q/42234589/812183):\r\n\r\n```python\r\nrequest = urllib.request.Request(get_file_url, headers=self.data_api_headers)\r\n\r\nwith urllib.request.urlopen(request) as response:\r\n with open(export_file_path, 'wb') as out_file:\r\n\r\n shutil.copyfileobj(response, out_file)\r\n```\r\n\r\nThis fails with `Argument 1 to \"copyfileobj\" has incompatible type \"Union[HTTPResponse, BinaryIO]\"; expected IO[Any]` because `HTTPResponse` derives from `io.BufferedIOBase`, which (despite being a binary IO) does not derive from `typing.BinaryIO` (nor does `io.RawIOBase`; also `io.IOBase` does not derive from `typing.IO`).\r\n\r\nWhen I attempted to derive them as I thought would make sense, I got errors because `__enter__` and other methods are defined both in `io.IOBase` and in `typing.BinaryIO`.\r\n\r\nNot sure how to solve it.","author":{"url":"https://github.com/asottile","@type":"Person","name":"asottile"},"datePublished":"2018-06-04T01:38:09Z","url":"https://github.com/python/typeshed/issues/2189"}
| 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:459d042e-b047-44e0-a54a-a0e0009e4512 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C382:3B60C0:4340EF:5A4999:6B002B67 |
| html-safe-nonce | 254cb53fde88cad7f6ca219128c9dcfb9c7b191117d95738c7045d42d53cb9a6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzgyOjNCNjBDMDo0MzQwRUY6NUE0OTk5OjZCMDAyQjY3IiwidmlzaXRvcl9pZCI6IjM2NjAxNjc0MDc3MDk3Mjc1OTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 937b000b31c25e0e3602bb936b920f8286bae575098ac1314f6592a17ea20fec |
| hovercard-subject-tag | issue:328882968 |
| 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/2189/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3d619396c53f196d0dbdb70c29d9788afd2c88072bc967bd7c2705727487557b/python/typeshed/issues/2189 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3d619396c53f196d0dbdb70c29d9788afd2c88072bc967bd7c2705727487557b/python/typeshed/issues/2189 |
| og:image:alt | Copied from python/mypy#3108 From SO: request = urllib.request.Request(get_file_url, headers=self.data_api_headers) with urllib.request.urlopen(request) as response: with open(export_file_path, 'wb... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | asottile |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width