ipython / ipython/traitlets

Pyright diagnostic type incompatible

Ouverte
#853 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
653
Forks
217
Merge moyen
2 j 21 h
PR mergées (30 j)
2

Description

```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?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.