tensorflow / tensorflow/probability
Importing ABC directly from collections was deprecated from Python 3.4 and will be removed in 3.10
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Importing ABC directly from collections was deprecated from 3.4 and will be removed in 3.10. Using collections.abc is recommended. Since the project is Python 3 only it doesn't require Python 2/3 shims for the fix.
rg "collections\.(Awaitable|Coroutine|AsyncIterable|AsyncIterator|AsyncGenerator|Hashable|Iterable|Iterator|Generator|Reversible|Sized|Container|Callable|Collection|MutableSet|Mapping|MutableMapping|MappingView|KeysView|ItemsView|ValuesView|Sequence|MutableSequence|ByteString)\b"
discussion/fun_mcmc/fun_mcmc_lib.py
291: args, collections.Sequence) and not mcmc_util.is_namedtuple_like(args):
294: elif isinstance(args, collections.Mapping):
332: if not isinstance(ret, collections.Sequence) or len(ret) != 2:
373: if not isinstance(ret, collections.Sequence) or len(ret) != 2:
434: if not isinstance(ret, collections.Sequence) or len(ret) != 2:
discussion/nn/variational_base.py
65: if isinstance(weights, collections.Mapping):
tensorflow_probability/python/distributions/mixture_same_family.py
206: list(slices) if isinstance(slices, collections.Sequence) else [slices])
tensorflow_probability/python/distributions/distribution_properties_test.py
500: tuple(slices) if isinstance(slices, collections.Sequence) else
tensorflow_probability/python/distributions/distribution.py
1503: if (isinstance(x, collections.Sequence) and
1510: if isinstance(x, collections.Mapping):
tensorflow_probability/python/distributions/joint_distribution_named.py
282: return hasattr(x, '_asdict') or isinstance(x, collections.Mapping)
tensorflow_probability/python/distributions/independent.py
181: slices = (tuple(slices) if isinstance(slices, collections.Sequence)
tensorflow_probability/python/internal/nest_util.py
78: return (isinstance(args, collections.Sequence) and
84: return isinstance(args, collections.Mapping) and not _force_leaf(args)
tensorflow_probability/python/distributions/joint_distribution_sequential.py
232: if not isinstance(model, collections.Sequence):
tensorflow_probability/python/layers/distribution_layer.py
172: value_is_seq = isinstance(d.dtype, collections.Sequence)
tensorflow_probability/python/distributions/internal/slicing.py
180: if not isinstance(slices, collections.Sequence):
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided rg command and inspect each reported file, including discussion/fun_mcmc/fun_mcmc_lib.py, tensorflow_probability/python/distributions/distribution.py, and the related test file. Update the deprecated collections ABC references consistently, then run the affected distribution tests and confirm the search no longer finds deprecated usages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100