python / typeshed

Collection of library stubs for Python, with static types
Other
4.35k stars 1.74k forks source link

Multiple incompatibilities for the type of self #638

Closed elazarg closed 7 years ago

elazarg commented 7 years ago

During my work (mypy/#2381) on a fix for mypy/#2374, I have encountered many bad signatures - mostly missing the self parameter - in the following methods (only a selection of them was chekced manually by me)

Python3

  1. stdlib/3/multiprocessing/managers.pyi:8: multiprocessing.managers.BaseManager.register
  2. stdlib/3/ssl.pyi:222: ssl.SSLContext.set_alpn_protocols
  3. stdlib/3/ssl.pyi:223: ssl.SSLContext.set_npn_protocols
  4. stdlib/3/ssl.pyi:234: ssl.SSLContext.wrap_bio
  5. stdlib/3/unittest.pyi:141: unittest.TestCase.addCleanup
  6. stdlib/3/urllib/request.pyi:120: urllib.request.HTTPPasswordMgrWithPriorAuth.update_authenticated
  7. stdlib/3/urllib/request.pyi:122: urllib.request.HTTPPasswordMgrWithPriorAuth.is_authenticated
  8. stdlib/3/urllib/request.pyi:194: urllib.request.URLopener.retrieve
  9. stdlib/3/urllib/request.pyi:77: urllib.request.BaseHandler.http_error_nnn
  10. stdlib/3/urllib/robotparser.pyi:9: urllib.robotparser.RobotFileParser.__init__

Python2:

  1. stdlib/2/imp.pyi:35: imp.NullImporter.find_module
  2. stdlib/2/select.pyi:97: select.epoll.unregister
  3. stdlib/2/select.pyi:98: select.epoll.poll
  4. stdlib/2/shlex.pyi:13: shlex.shlex.error_leader
  5. stdlib/2/ssl.pyi:172: ssl.SSLContext.set_alpn_protocols
  6. stdlib/2/ssl.pyi:173: ssl.SSLContext.set_npn_protocols
  7. stdlib/2/_struct.pyi:12: _struct.Struct.pack_into
  8. stdlib/2/_symtable.pyi:39: _symtable.symtable.__init__
  9. stdlib/2/tempfile.pyi:31: tempfile._RandomNameSequence.normcase
  10. stdlib/2/tempfile.pyi:45: tempfile._TemporaryFileWrapper.unlink
  11. The third overload of file.__init__:
    def __init__(file: int, mode: str = 'r', buffering: int = ...) -> None: ...

Also, tons of __builtin__ mismatches (possibly spurious).

Third party:

  1. third_party/3/pkg_resources.pyi:228: IMetadataProvider.*
  2. third_party/2/pymssql.pyi:21: pymssql.Cursor.callproc
gvanrossum commented 7 years ago

Eew! So good to catch these. Can you submit fixes? One PR per subdirectory would be fone.