ipython / ipython/traitlets

Pyright diagnostic type incompatible

Abierto
#853 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
653
Forks
217
Merge medio
2 d 21 h
PR fusionados (30 d)
2

Descripción

```python
@magics_class
class SimpleGPTMagics(Magics):
api_type = Unicode("openai", help="The type of api that will be used to query the models").tag(config=True)

```
[pyright](https://microsoft.github.io/pyright/) report
```
Diagnostics:
1. Argument of type "Literal['openai']" cannot be assigned to parameter "default_value" of type "Sentinel" in function "__init__"
  "Literal['openai']" is incompatible with "Sentinel" [reportGeneralTypeIssues]

```

https://github.com/ipython/traitlets/blob/05d6ecb6b1f90736cdeacf41c7d5e84b147c1dbd/traitlets/traitlets.py#L479-L497

https://github.com/ipython/traitlets/blob/05d6ecb6b1f90736cdeacf41c7d5e84b147c1dbd/traitlets/traitlets.py#L135-L141

Obviously, the argument of `TraitType.__init__`, `default_vaue` is infered to `Sentinel`, what can I do to suppress the diagnostic?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.