Can't use a subscripted `ThingSlot`
Mantenedores costumam responder em até 3 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 55/100
Direção de pesquisa
Start by reading the ThingSlot and BaseDescriptor definitions and the code that handles __orig_class__; the issue identifies the mismatch between the one-parameter subscription and the descriptor’s two type parameters. Check existing tests for thing_slot() and descriptor typing behavior. Done means ThingSlot[MyOtherThing]() works as expected or the supported behavior is documented clearly.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
The public API says I should define a Thing Slot like:
class MyThing(lt.Thing):
other_thing: MyOtherThing = lt.thing_slot()
This works fine.
I expected I could also do this:
class MyThing(lt.Thing):
other_thing = ThingSlot[MyOtherThing]()
The second form (which isn't recommended anywhere) does not work. The reason for this is that BaseDescriptor expects two type parameters, the first is the host class and the second is the value. When it calls __orig_class__, it gets ThingSlot[ValueType] and not BaseDescriptor[lt.Thing, ValueType].
To Reproduce
Define a ThingSlot using the type in a subscript, as shown above.
Expected behaviour
I hoped the two examples above would be equivalent.
Additional context
The subscripted form is not really used or recommended anywhere. We could just remove it - but I feel like it has its uses. This isn't blocking anything, so it's likely to sit in the backlog for a little while.
- Linguagem predominante
- Python
- Estrelas
- 10
- Forks
- 4
- Merge médio
- 4d 15h
- PRs com merge (30d)
- 11
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
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 labthings/labthings-fastapi
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
labthings/labthings-fastapi#438 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
labthings/labthings-fastapi#435 ·
Mantenedores costumam responder em até 3 dias
-
Consider atomic JSON writesTalvez livre de novo @ashiishe2-oss assumiu há 26 dias e não há nenhum pull request aberto. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
labthings/labthings-fastapi#412 · 3 comentários ·
Mantenedores costumam responder em até 3 dias
-
Use `Exception.add_note`Abertadrop-python-version
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
labthings/labthings-fastapi#354 · 2 comentários ·
Mantenedores costumam responder em até 3 dias
-
Log propagation issueAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
labthings/labthings-fastapi#312 · 1 comentário ·
Mantenedores costumam responder em até 3 dias
Todas as issues de labthings/labthings-fastapi
Issues semelhantes
-
bug feature request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Qiskit/qiskit-obp#156 ·
-
perf(batch-jobs): discover-misses reads the state list without running the whole stage reportAbertaaction-item enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
getcommunityone/open-navigator#1658 ·
Mantenedores costumam responder em até 1 dia
-
review-panel severity:low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
kristovatlas/coin-accounting#636 ·
Mantenedores costumam responder em até 1 dia