Title: Accidentally abstract classes · Issue #1476 · python/typeshed · GitHub
Open Graph Title: Accidentally abstract classes · Issue #1476 · python/typeshed
X Title: Accidentally abstract classes · Issue #1476 · python/typeshed
Description: We've had several issues where mypy produces incorrect "Cannot instantiate abstract class" errors because of faulty typeshed stubs (e.g., #1379, #1160, #351, #1475). To find more bugs like those, I hacked mypy (JelleZijlstra/mypy@1fa9c65...
Open Graph Description: We've had several issues where mypy produces incorrect "Cannot instantiate abstract class" errors because of faulty typeshed stubs (e.g., #1379, #1160, #351, #1475). To find more bugs like those, I...
X Description: We've had several issues where mypy produces incorrect "Cannot instantiate abstract class" errors because of faulty typeshed stubs (e.g., #1379, #1160, #351, #1475). To find more bugs...
Opengraph URL: https://github.com/python/typeshed/issues/1476
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Accidentally abstract classes","articleBody":"We've had several issues where mypy produces incorrect \"Cannot instantiate abstract class\" errors because of faulty typeshed stubs (e.g., #1379, #1160, #351, #1475). To find more bugs like those, I hacked mypy (https://github.com/JelleZijlstra/mypy/commit/1fa9c65ea9db9d9024556002e39ab58b5c33997c) to error on any class with abstract methods. Here are the results for 3.6, excluding private classes and those clearly intended to be abstract:\r\n\r\n- [x] `stdlib/3/collections/__init__.pyi:62: error: Class collections.UserDict has abstract attributes ['__delitem__', '__getitem__', '__iter__', '__len__', '__setitem__']`\r\n- [x] `stdlib/3/collections/__init__.pyi:63: error: Class collections.UserList has abstract attributes ['__delitem__', '__getitem__', '__len__', '__setitem__', 'insert']`\r\n- [x] `stdlib/3/collections/__init__.pyi:64: error: Class collections.UserString has abstract attributes ['__getitem__', '__len__']`\r\n- [x] `third_party/2and3/requests/structures.pyi:5: error: Class requests.structures.CaseInsensitiveDict has abstract attributes ['__delitem__', '__getitem__', '__iter__', '__len__', '__setitem__']`\r\n- [x] `third_party/2and3/pytz/lazy.pyi:6: error: Class pytz.lazy.LazyDict has abstract attributes ['__getitem__', '__iter__', '__len__']`\r\n- [x] `stdlib/2and3/codecs.pyi:205: error: Class codecs.StreamReaderWriter has abstract attributes ['close', 'fileno', 'flush', 'isatty', 'readable', 'seekable', 'tell', 'truncate', 'writable']`\r\n- [x] `stdlib/2and3/codecs.pyi:221: error: Class codecs.StreamRecoder has abstract attributes ['__enter__', '__exit__', '__iter__', '__next__', 'close', 'fileno', 'flush', 'isatty', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']`\r\n- [x] `stdlib/2and3/bz2.pyi:14: error: Class bz2.BZ2File has abstract attributes ['__enter__', '__exit__', '__iter__', '__next__', 'close', 'fileno', 'flush', 'isatty', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']`\r\n- [x] `stdlib/3/urllib/response.pyi:6: error: Class urllib.response.addinfourl has abstract attributes ['__enter__', '__exit__', '__iter__', '__next__', 'close', 'fileno', 'flush', 'isatty', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']`\r\n- [x] `stdlib/3/http/cookies.pyi:21: error: Class http.cookies.BaseCookie has abstract attributes ['__delitem__', '__getitem__', '__iter__', '__len__']`\r\n- [x] `stdlib/3/http/cookies.pyi:31: error: Class http.cookies.SimpleCookie has abstract attributes ['__delitem__', '__getitem__', '__iter__', '__len__']`\r\n- [x] `stdlib/3.4/tracemalloc.pyi:64: error: Class tracemalloc.Traceback has abstract attributes ['__getitem__', '__len__']`\r\n- [x] `stdlib/3.4/enum.pyi:7: error: Class enum.EnumMeta has abstract attributes ['__len__']`\r\n- [x] `stdlib/2and3/distutils/cmd.pyi:7: error: Class distutils.cmd.Command has abstract attributes ['finalize_options', 'initialize_options', 'run']`\r\n- [x] `stdlib/3/urllib/error.pyi:8: error: Class urllib.error.HTTPError has abstract attributes ['__enter__', '__exit__', '__iter__', '__next__', 'close', 'fileno', 'flush', 'isatty', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']`\r\n- [x] `stdlib/3/io.pyi:260: error: Class io.IncrementalNewlineDecoder has abstract attributes ['decode']`\r\n- [x] `stdlib/3/encodings/utf_8.pyi:3: error: Class encodings.utf_8.IncrementalEncoder has abstract attributes ['encode']`\r\n- [x] `stdlib/3/encodings/utf_8.pyi:5: error: Class encodings.utf_8.IncrementalDecoder has abstract attributes ['_buffer_decode']`\r\n- [x] `stdlib/2and3/distutils/command/build_py.pyi:7: error: Class distutils.command.build_py.build_py has abstract attributes ['finalize_options', 'initialize_options', 'run']`\r\n- [x] `stdlib/2and3/distutils/command/build_py.pyi:8: error: Class distutils.command.build_py.build_py_2to3 has abstract attributes ['finalize_options', 'initialize_options', 'run']`\r\n- [x] `stdlib/2and3/distutils/command/bdist_msi.pyi:5: error: Class distutils.command.bdist_msi.bdist_msi has abstract attributes ['finalize_options', 'initialize_options', 'run']`\r\n- [x] `stdlib/3.4/asyncio/events.pyi:207: error: Class asyncio.events.BaseDefaultEventLoopPolicy has abstract attributes ['get_child_watcher', 'set_child_watcher']`\r\n- [x] `stdlib/2and3/asynchat.pyi:12: error: Class asynchat.async_chat has abstract attributes ['collect_incoming_data', 'found_terminator']`\r\n- [x] `third_party/2and3/requests/packages/urllib3/response.pyi:25: error: Class requests.packages.urllib3.response.HTTPResponse has abstract attributes ['__enter__', '__exit__', '__iter__', '__next__', 'isatty', 'readline', 'readlines', 'seek', 'seekable', 'truncate', 'writable', 'write', 'writelines']`\r\n- [x] `third_party/2and3/requests/cookies.pyi:44: error: Class requests.cookies.RequestsCookieJar has abstract attributes ['__len__']`\r\n\r\nI believe most of these aren't intended to be abstract.","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2017-07-11T05:00:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/1476/typeshed/issues/1476"}
| 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:8a0c23aa-27a7-5a71-6feb-a09cb90fd97c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CF2:23E3E9:ABE6D92:AF61BEE:6A50BD92 |
| html-safe-nonce | 912d82bdf0651047dd2fce7a0e3f0f7b108c04fb276b35608d1d921a67fc2ece |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0YyOjIzRTNFOTpBQkU2RDkyOkFGNjFCRUU6NkE1MEJEOTIiLCJ2aXNpdG9yX2lkIjoiNTYxMjExNDYxMjE4OTE4MzM3OCIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 98c69bd83dc086612176d74cd17e32c469d2848e61a821354856ee6e6fe6255a |
| hovercard-subject-tag | issue:241925490 |
| 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/1476/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d8643ec822b527526938a3b1dcfb902505592ef51c95927f2f8099704cadcbc3/python/typeshed/issues/1476 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d8643ec822b527526938a3b1dcfb902505592ef51c95927f2f8099704cadcbc3/python/typeshed/issues/1476 |
| og:image:alt | We've had several issues where mypy produces incorrect "Cannot instantiate abstract class" errors because of faulty typeshed stubs (e.g., #1379, #1160, #351, #1475). To find more bugs like those, I... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| 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 | 08e79d53fc070870d5b168356afebb1e286a2ffe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width