New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py3: import certain things from collections.abc #28012
Comments
Branch: u/slelievre/collections.abc |
Commit: |
New commits:
|
comment:4
Note: to check where such changes were needed I followed advice in a comment at #28002 and did
|
comment:5
More changes are needed, as revealed by
I'll push a commit. |
comment:6
The relevant lines in the output of
|
comment:7
Two comments: there may be instances of this in other packages, like matplotlib. Also, it's not just warnings silenced in #28002, but an older silencing in |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:10
Moving tickets from the Sage 8.8 milestone that have been actively worked on in the last six months to the next release milestone (optimistically). |
comment:11
Ticket retargeted after milestone closed |
comment:12
Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity. |
comment:14
Now that we don't support py2 any more, the try/except approach is not needed any more. |
Changed keywords from days101 to days101, collections.abc |
comment:15
Sorry for letting over a year pass by. Here is a new branch. Please review. The file Would there be an advantage, or a disadvantage, to doing the following instead:
and then using I changed to that style in some other files. New commits:
|
comment:25
The typical (but not universal) Sage style seems to be "from blah import foo" and then "foo(...)" rather than "import blah" and then "blah.foo(...)". So that's what I would choose, as you suggested. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:28
Fixed and rebased on 9.2.beta12. Sorry for one more force-push. |
comment:29
Still needs work. Almost there. Will push shortly. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:31
Please review. |
comment:32
Looks good to me. |
Reviewer: John Palmieri |
Changed branch from public/ticket/28012-collections.abc to |
comment:35
Follow-up at #30768 for unsilencing the deprecation warning. |
Changed commit from |
Background (read
Python 3 documentation for the
collections
modulefor more detail):
Collections Abstract Base Classes
("CABCs") moved to the
collections.abc
module in Python 3.3.These "Collections Abstract Base Classes" are:
AsyncGenerator
,AsyncIterable
,AsyncIterator
,Awaitable
,Bytestring
,Callable
,Collection
,Container
,Coroutine
,Generator
,Hashable
,ItemsView
,Iterable
,Iterator
,KeysView
,Mapping
,MappingView
,MutableMapping
,MutableSequence
,MutableSet
,Reversible
,Sequence
,Set
,Sized
,ValuesView
.For backwards compatibility, CABCs continue to be visible
in the
collections
module through Python 3.8; and can beimported either from
collections
or fromcollections.abc
.Starting with Python 3.9, CABCs must be imported from
collections.abc
.In Python 2 they could only be imported from 'collections',
not from 'collections.abc'. So while Sage was keeping
Py2 and Py3 compatible it made sense to import from
collections
.In Python 3.7 and Python 3.8, importing them from
collections
gives a deprecation warning. This warning was silenced in Sage,
see py3: last test in tests/cmdline.py #28002.
In this ticket we import the classes from
collections.abc
.We do not suppress the silencing of the deprecation warning yet.
See comment:23 and #30768.
CC: @fchapoton @jhpalmieri @slel @videlec @tscrim
Component: python3
Keywords: days101, collections.abc
Author: Samuel Lelièvre
Branch:
4f80136
Reviewer: John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/28012
The text was updated successfully, but these errors were encountered: