Skip to content

Merge from master#2

Merged
jolaf merged 59 commits intojolaf:masterfrom
python:master
Oct 21, 2019
Merged

Merge from master#2
jolaf merged 59 commits intojolaf:masterfrom
python:master

Conversation

@jolaf
Copy link
Owner

@jolaf jolaf commented Oct 21, 2019

No description provided.

CraftSpider and others added 30 commits October 7, 2019 17:05
* Update flake8-bugbear
* Remove unnecessary comment
* Add a comment about an upcoming fix
None values are accepted, and interpreted as empty (byte) strings by
some urllib.parse functions.
)

This is a continuation of #3291, which was the initial fix for #3201.

The 2-arg version of iter() turns a callable into an iterator. The
changes made in #3291 introduce an Any return type for both the
callable's return type and the iterator's type, while in reality the
return type of the function is always the same as the iterator's type.
Per the urllib.parse documentation, username, password, hostname,
and port will be set to None if not set in the parsed URL.  The
same is true for urlparse in Python 2 according to its documentation.
Nothing prevents a decorator defined using `@decorator` from
changing the signature of the decorated function. For example,
this example changes the return type to `str`:

```
from decorator import decorator

@decorator
def stringify(f, *args, **kwargs) -> str:
    return str(f(*args, **kwargs))
```

The old signature caused false positives in internal Dropbox code.

I couldn't come up with a signature that would produce better types
with mypy while not generating false positives.
From the Lib/csv.py source, 'f' is passed directly to _csv.reader, which
expects Iterable[Text]
* Add as_integer_ratio() to a few types

* Add dirs_exist_ok to copytree()

* int, float, complex accept __index__ args

Also fix complex.__init__ argument names

* Add __reversed__ to dict et al.

* Python 3.8 date(time) arithmetic fixes

* Add CodeType.replace()
* Add assorted annotations

* Fix type of Purpose items
This is important because mypy doesn't generally think functions are compatible with `FunctionType`, so `inspect.getsource` on arbitrary functions is rejected by the current annotations.
Remove unnecessary definitions in sub-classes.
Improve a few other types
utkarsh2102 and others added 29 commits October 12, 2019 21:27
While it may eventually be useful to mark the exceptions that can be
raised from a function or method, the semantics are currently undefined
and unclear.
* macpath
* time.clock()
* Some cgi functions
* XMLParser(html) and doctype()
* unicode_internal
* Two sqlite3 classes hidden
* fileinput bufsize arg
* Treeview.selection no longer takes arguments
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
* Make multiprocessing stubs match implementation

* Add multiprocessing.process.BaseProcess
* Use BaseProcess in multiprocessing.context where applicable
* Remove non-existing BaseContext.Process()
* Derive DefaultContext from BaseContext
* Fix BaseContext/DefaultContext.set_start_method() signatures
* Re-export multiprocessing.context.Process from multiprocessing,
  instead of using a custom definition
* Re-export multiprocessing.active_from from multiprocessing.process
  instead of using a custom definition

* Add parent_process() (Python 3.8)

* Complete BaseManager; add Server

* Add multiprocessing.shared_memory et al
* protobuf: Fix inadvertantly deleted annotations.

* Run black on protobuf.
* Add public missing asyncio stubs for windows and proactor files, and any necessary private return/argument types.

* Add methods to BaseProactorEventLoop that mypy is complaining about, with note about status at runtime

* Add asyncio constants file
The value can be None here as well as in handle_starttag().
From python/mypy#7582.

This partially reverts back the change in
0ee7c3c to have `__import__` return
`Any` instead of `ModuleType`.
shlex.shlex should match the Iterator protocol, for which it needs both
`__iter__` and `__next__` (`next` in Python 2) defined.
Yesterday's release contains a number of pyi parser fixes, such as
support for the syntax in #3321.
@jolaf jolaf merged commit 6147b57 into jolaf:master Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.