Using `types` classes over `collections.abc`'s bases
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 30/100
Direção de pesquisa
Comece revisando as classes de collections.abc.pyi e os pull requests vinculados de typeshed e CPython. Em seguida, examine como os verificadores de tipos inferem funções geradoras, de coroutine e de gerador assíncrono. Considera-se concluído quando os tipos abstratos e concretos apresentarem o comportamento proposto em tempo de execução e de inferência em todas as alterações identificadas.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Currently collections.abc.Generator/Coroutine/AsyncGenerator etc. have attributes that don't have to exist at runtime. I think it'd be wise to switch recommending to using the types concrete classes where possible over the abstract versions which have a smaller interface because having this weird sort of duplication where the 2 are basically the same is a wrinkle that's bitten me recently. To do this I think a few things need to happen:
- make the classes in
collections.abc.pyiProtocols that should be based on their runtime implementation (they implement custom__subclasshook__) and not the concrete types. (https://github.com/python/typeshed/pull/10816) - make the
typesclasses subscriptable at runtime. (https://github.com/python/cpython/pull/110212) - make type checkers infer things like
def foo(): yieldastypes.GeneratorTypeand not justcollections.abc.Generator.
(as a small aside it might be nice to move the type implementations from typing to collections.abc soon)
- Linguagem predominante
- Python
- Estrelas
- 1.8k
- Forks
- 302
- Merge médio
- 23h
- PRs com merge (30d)
- 8
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python/typing
-
topic: typing spec
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
topic: typing spec
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
topic: documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
topic: documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
-
topic: conformance tests topic: typing spec
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
Todas as issues de python/typing
Issues semelhantes
-
area: harness bug status: needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Human-Agent-Society/reef#625 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 80/100
learningequality/kolibri#15351 · 2 comentários ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
Name consistency Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
eellak/triplestore#65 · 1 comentário ·